-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ParseLiveQuery Subscription as a SwiftUI view model #65
Conversation
Conflicts: ParseSwift.podspec ParseSwift.xcodeproj/project.pbxproj Scripts/jazzy.sh
Codecov Report
@@ Coverage Diff @@
## main #65 +/- ##
==========================================
+ Coverage 77.95% 78.11% +0.15%
==========================================
Files 51 51
Lines 4578 4614 +36
==========================================
+ Hits 3569 3604 +35
- Misses 1009 1010 +1
Continue to review full report at Codecov.
|
@TomWFox I added docs to the "new" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one .
😅
LGTM 🚀
Co-authored-by: Tom Fox <13188249+TomWFox@users.noreply.github.com>
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