提问人:Vishnu 提问时间:9/29/2023 最后编辑:Vishnu 更新时间:10/6/2023 访问量:77
iOS RealmSwift DB 迁移主键
iOS RealmSwift DB Migration Primary Keys
问:
我正在从 Obj-C 领域迁移到 RealmSwift。我在以下代码中使用了主键和数据类型,进行了一些更改,
migrationBlock: { migration, oldSchemaVersion in
if (oldSchemaVersion < 1) {
migration.enumerateObjects(ofType: Countries.className()) { oldObject, newObject in
newObject!["Country_Code"] = oldObject!["Country_Code"]
}
}
有没有办法动态迁移属性,而无需对每个属性进行硬编码。
我们尝试使用嵌套迁移。
答: 暂无答案
评论