Skip to content
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

Add combine publishers for all objects and types #73

Merged
merged 15 commits into from
Jan 31, 2021
Merged

Add combine publishers for all objects and types #73

merged 15 commits into from
Jan 31, 2021

Conversation

cbaker6
Copy link
Contributor

@cbaker6 cbaker6 commented Jan 30, 2021

Adding the publishers such as Future to all one-shot async calls, making Parse-Swift modernized and SwiftUI ready. All methods that are capable of “publishing” end with the word Publisher. This means that there are 3 ways to use most of the methods that send/receive info to a Parse Server: 1) sync, 2) async, and 3) publisher.

As far as usage, you use the added publishers just like any other Combine publisher. The thing to remember is that all of the push/pull methods like save, fetch, etc. are Futures, so they start their work as soon as you call them and will only publish one result when finished. Any new subscriptions to an already fulfilledFuture will produce the original result. This is different from the ParseLiveQuery Subscription which will keep publishing events/subscriptions as long as it’s not cancelled.

Combine currently isn't supported on Linux, but if/when it ever is the combine features will automatically be available for use. Linux devs can use the async/sync callbacks instead.

  • All objects publishable
  • All types publishable
  • Testcases
  • Some fixes to ParseUser.logout to make it more predictable
  • Bring minimum deployment to the same level on Xcode, SPM, and Cocoapods, [.iOS(.v12), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v5)]. If a developer wants to support an older platform, they should use the Parse-Obj-C SDK

Slightly breaking (compiler should suggest the correct fix):

  • delete, deleteAll, passwordReset, and verificationEmail use to all return an ParseError. These have all been switched to return a Result<Void, ParseError> instead to match everything else. This is helpful, because Future expects a result enum anyways

@codecov
Copy link

codecov bot commented Jan 30, 2021

Codecov Report

Merging #73 (9b4a35d) into main (48a871e) will increase coverage by 0.45%.
The diff coverage is 89.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #73      +/-   ##
==========================================
+ Coverage   78.45%   78.91%   +0.45%     
==========================================
  Files          52       61       +9     
  Lines        4693     4870     +177     
==========================================
+ Hits         3682     3843     +161     
- Misses       1011     1027      +16     
Impacted Files Coverage Δ
Sources/ParseSwift/API/BatchUtils.swift 100.00% <ø> (ø)
...Authentication/Protocols/ParseAuthentication.swift 72.63% <ø> (ø)
Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift 61.40% <ø> (ø)
Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift 74.61% <ø> (ø)
...t/LiveQuery/Protocols/ParseLiveQueryDelegate.swift 20.00% <ø> (ø)
Sources/ParseSwift/LiveQuery/Subscription.swift 67.27% <ø> (-18.67%) ⬇️
Sources/ParseSwift/Types/Query.swift 90.58% <ø> (-0.28%) ⬇️
...Swift/Authentication/Internal/ParseAnonymous.swift 80.00% <57.14%> (-6.96%) ⬇️
...rseSwift/Authentication/3rd Party/ParseApple.swift 75.64% <69.23%> (-3.21%) ⬇️
Sources/ParseSwift/Objects/ParseInstallation.swift 82.15% <76.47%> (-0.07%) ⬇️
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48a871e...738eccd. Read the comment docs.

@cbaker6 cbaker6 requested a review from TomWFox January 30, 2021 22:51
@cbaker6
Copy link
Contributor Author

cbaker6 commented Jan 30, 2021

@TomWFox can you review the docs? All of the added docs are SwiftUI docs.

The large number of line additions is mostly test code

Copy link
Contributor

@TomWFox TomWFox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Sources/ParseSwift/Types/ParseFile+combine.swift Outdated Show resolved Hide resolved
cbaker6 and others added 2 commits January 31, 2021 12:17
Co-authored-by: Tom Fox <13188249+TomWFox@users.noreply.github.com>
[.iOS(.v12), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v5)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants