Declaration

Specify a schema version and an associated migration block which is applied when
opening the default Realm with an old schema version.

Before you can open an existing Realm which has a different on-disk schema
from the schema defined in your object interfaces, you must provide a migration
block which converts from the disk schema to your current object schema. At the
minimum your migration block must initialize any properties which were added to
existing objects without defaults and ensure uniqueness if a primary key
property is added to an existing object.

You should call this method before accessing any Realm instances which
require migration. After registering your migration block, Realm will call your
block automatically as needed.

Parameters

Specify a schema version and an associated migration block which is applied when
opening a Realm at the specified path with an old schema version.

Before you can open an existing Realm which has a different on-disk schema
from the schema defined in your object interfaces, you must provide a migration
block which converts from the disk schema to your current object schema. At the
minimum your migration block must initialize any properties which were added to
existing objects without defaults and ensure uniqueness if a primary key
property is added to an existing object.

You should call this method before accessing any Realm instances which
require migration. After registering your migration block, Realm will call your
block automatically as needed.

Return Value

This method is called automatically when opening a Realm for the first time and does
not need to be called explicitly. You can choose to call this method to control
exactly when and how migrations are performed.