-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Local
-
None
-
1 - XS (<= 1 day)
-
5
-
582
In Realm Java we expose a getRealm() method on Objects, Results and Lists. The reason being that in very modular code, you avoid having to pass around the pair of (Realm, Object).
This was particular relevant in Java where the Realm might be thread-confined.
In Kotlin, the Realm can be a global singleton so there is less need for it, but I still ran into a use case for why we probably want to do it anyway: Extension functions.
Since they live in complete isolation, being able to find the Realm from any Realm object seems pretty useful. My use case was wanting to create an {{object.write { }}} method.