vicpinm / Kotlin-Realm-Extensions

Kotlin extensions to simplify Realm API.
Apache License 2.0
535 stars 53 forks source link

Detached Realm objects #3

Closed thebrokenbar closed 7 years ago

thebrokenbar commented 7 years ago

Why queries return only detached objects? Isn't Realm so great because of data attached to it's reference?

Great work btw. 👍

vicpinm commented 7 years ago

Attached objets have an important constraint: they cannot be used through differens threads. So if you perform your queries on a background thread, results cannot be returned to de main thread in order to be used in your ui layer. Nevertheless, I will add a method like queryManaged(), in order to perform queries that return attached realm objects, in case anyone needs it.