Repository navigation
Migrating to 6.0.0+ With Complete Concurrency #225
cbaker6
announced in
Announcements
Replies: 1 comment
|
Thanks for keeping this project alive. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Version 6.0.4 of Parse-SwiftOG has been released and has a plethora of new features and updates (see API and tutorial documentation). In addition, the latest version can take advantage of all of the new features in Parse Server 9.1.1+ and still works with Parse Server 4.0.0+ (see a list of features in #72). Version 6.0.0+ has been modernized and optimized to better leverage the latest features in Swift and provide a more intuitive experience for developers than previous versions. Under the hood, 6.0.0+ uses strict concurrency, which allows the compiler to conclusively prove different parts of the SDK can run concurrently.
Test Drive 6.0.0+ with Parse Server 9.1.1+
Deploying a local Parse Server is quick and easy via Docker. All of the Swift Playgrounds can be run locally in Xcode
parse-swiftbranch), change directories into the parse-hipaa folder in your terminal, typedocker-compose up. The latest parse-hipaa serve which is built with the latest Parse Server should be up and running. You can find more information hereParse.xcworkspaceParseSwift (macOS)framework when using Swift PlaygroundsProject Navigatorpane and selectParseSwift-> 1 - Your first Object. All Playground files are located hereUpgrading
To upgrade (If you are attempting to migrate from the
parse-community/Parse-Swift, please read #70 first). Otherwise, you can follow the steps below:Project NavigatorpanelPackage DependenciestabDependency Rule, selectUp to Next Major Versionand input6.0.0for the specific version and< 7.0.0To adapt to 6.0.0+, you will need to make some required changes to your apps. Note that your whole app DOES NOT need to be in Swift 6 Language mode to use ParseSwift 6.0.0+ (more information on incremental migrations). Some notable changes are below:
Breaking Changes
Sendableand reducing the possibility of data races. Added WASM support. Multiple batches now perform asynchronously (#208).Almost every object in the SDK is either Sendable or
nonisolated(unsafe)with mutating properties protected with NSLock's. OnlyView Modelsin the SDK use@MainActorwith all other calls running on the queue they were called on (this is the same as ParseSwift 5.x). All completion handlers default to returning to themain queueunless specified as an argument when calling the respective method (this is the same as ParseSwift 5.x). To migrate, you can remove any@preconcurrencyimports related to ParseSwift, since the SDK is now under strict concurrency. Most of the changes you will need to make will be related to ensuring you haveSendableclosures. Example below:In addition, any class that subclasses
ParseLiveQueryDelegateneeds to also subclassNSObjectand should be afinal class. LiveQuery subscription classes such asSubscriptionandSubscriptionCallbackare@unchecked Sendableand useNSLockunder the hood to manage state internally in the SDK. If you subclassSubscriptionandSubscriptionCallback, you are responsible for maintaining the state of all added mutable properties using NSLock, Mutex, etc. Please see Hacking With Swift and Avander Lee's posts to learn more about Swift 6 complete concurrency.All reactions