Android でこれを実現する方法はありますが、iOS のアプローチにはまだ戸惑っています。新しい更新があるたびに移行を行いたくないので、そうであれば最初からやり直すことを好みます。
これに関連するこの質問を見つけました
このコードは移行にのみ使用できますか?
// Notice setSchemaVersion is set to 1, this is always set manually. It must be
// higher than the previous version (oldSchemaVersion) or an RLMException is thrown
[RLMRealm setSchemaVersion:1
forRealmAtPath:[RLMRealm defaultRealmPath]
withMigrationBlock:^(RLMMigration *migration, uint64_t oldSchemaVersion) {
// We haven’t migrated anything yet, so oldSchemaVersion == 0
if (oldSchemaVersion < 1) {
// Nothing to do!
// Realm will automatically detect new properties and removed properties
// And will update the schema on disk automatically
}
}];