Realm Migration — Renaming a class and migrating nested objects


Realm objects structure before the migration
Realm objects structure at the end of the migration

Renaming a class

“Renaming” a Realm class and migrating the user’s data

Migrate a complex Realm object included in another Realm object

First migration step: create the new object and migrate attributes
Recovery of the Sport object from the User object in type“Any”
Sport object data from the User object
Sport object from User object casted to Realm object
Compilation error when we try to access to the Sport ID of the user like a key value dictionary
One solution to get the ID of the Sport object from the User object
The final solution

What’s next?

This is Lunabee Studio’s account, on which we share content on various topics, including of course Mobile Apps’ creation.