是否有文档记录的方式或示例来查询或从其他表中获取属性的值?
现在我有:
Type
然后我在Realm的迁移模块中称它为
private func getFullnameFromPerson(_ migration: Migration, _ userId: String) -> String {
var fullname = ""
migration.enumerateObjects(ofType: Person.className(), {oldObject, newObject in
let _userId = newObject?["userId"] as? String
if _userId == userId {
let firstname = oldObject?["firstName"] as? String ?? ""
let lastname = oldObject?["lastName"] as? String ?? ""
fullname = "\(firstname) \(lastname)"
}
})
return fullname
}
这样可以吗?还是应该有更适当的方法?