Projections
#7605
Replies: 1 comment
-
The main benefit is that ViewModels build on Projections stay observable. So you can bind their properties directly in SwiftUI, and the views will automatically update when anything changes. If you manually build the ViewModel by copying the individual values, you will also have to observe all of them and manually pass on the change events to the UI as they happen. Projections saves you all that work. Think of them as a ViewModel construction kit 😉. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all!
Realm Swift 10.21.0 includes the new
Projection
feature. I'm just a bit curious as to the main purpose of this.For the given
Person
example, is there any advantage to using aPersonProjection
instead of creating my ownViewModel
type? i.e.Does it optimise queries deep in Realm, or is the feature more about creating a convenient re-usable projection type for use in View Models?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions