11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Realm 0.95.0] Migrationの書き方

Posted at

Realm Swift0.95.0でAPIが色々変わったので、メモ。

ChangeLog

realm-cocoa/CHANGELOG.md

Migrationの書き方

AppDelegate
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

//↓↓↓↓

  let config = Realm.Configuration(
    schemaVersion: 1,
    migrationBlock: { migration, oldSchemaVersion in
      if (oldSchemaVersion < 1) {
      }
    })

  Realm.Configuration.defaultConfiguration = config

  let realm = Realm()
//↑↑↑↑

References

Official

11
11
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?