Skip to content

Instantly share code, notes, and snippets.

@cmelchior
Created July 16, 2021 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmelchior/8ce660e2b492351ab1725dd93eccbef1 to your computer and use it in GitHub Desktop.
Save cmelchior/8ce660e2b492351ab1725dd93eccbef1 to your computer and use it in GitHub Desktop.
Realm Kotlin 0.40 Release Blog Post - Version Pinning
// BAD: Store a global managed object
MyApp.GLOBAL_OBJECT = realm.objects(Person::class).first()
// BETTER: Copy data out into an unmanaged object
val person = realm.objects(Person::class).first()
MyApp.GLOBAL_OBJECT = Person(person.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment