Use ParseLiveQuery Subscription as a SwiftUI view model #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support to use a
ParseLiveQuery
subscription as a VM. Once more people start using the SDK, this will probably be a highly sought after feature.ParseLiveQuery
and its ability to subscribe to events is suited to be a great candidate for SwiftUI updates or serve as a publisher of data in general to allow updates to views. The originalSubscription
, now renamed toSubscriptionCallback
was a spin on the originalSubscription
inParseLiveQuery-iOS
. The newSubscription
and the original essentially behave in a similar manner except the original was designed before property wrappers and before SwiftUI.The change allows devs a different way from the objective-c SDK when accessing Parse data.
ParseLiveQuery
Subscription as a view model (VM) for any subsequent updates in your SwiftUI view.This update is "slightly" breaking as the original
Subscription
has been renamed toSubscriptionCallback
. Both still have properties accessible directly from anyQuery
. For example if you havevar query = GameScore.query("score" > 9)
. Then:Subscription
-let subscription = query.subscribe
SubscriptionCallback
-let subscription = query.subscribeCallback