Issue #810

struct User {
    var createdAt: Date
    var name: Sttring
    var locked: Bool
}
extension KeyPath where Root == User {
    var keyPathString: String {
        switch self {
        case \User.createdAt: return "createdAt"
        case \User.name: return "name"
        case \User.locked: return "locked"
        default: return ""
        }
    }
}

Then we can call

reference
            .collection("users")
            .document(user.id)
            .updateData([
                (\User.locked).keyPathString:. true
            ])