* `@preconcurrency @MainActor` isolation of `Store` * Remove unneeded `@MainActor`s * Remove thread checking code * Remove unneeded `@MainActor`s * Swift 5.10 compatibility fixes * wip * More 5.10 fixes * wip * fixes * wip * wip * up the timeout * wip * Fixes * Remove mainActorASAP in favor of mainActorNow. (#3288) * wip * Run swift-format * Update README.md * Fix integration tests. (#3294) * Fix integration tests. * wip * wip * Run swift-format * mainActorNow doesnt need escaping closure * wip * migration guide * wip * Update MigratingTo1.14.md --------- Co-authored-by: Brandon Williams <mbrandonw@hey.com> Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com> Co-authored-by: mbrandonw <mbrandonw@users.noreply.github.com>
1.3 KiB
Migrating to 1.14
The Store type is now officially @MainActor isolated.
Overview
As the library prepares for Swift 6 we are in the process of updating the library's APIs for
sendability and isolation where appropriate, and doing so in a backwards compatible way. Prior
to version 1.14 of the library the Store type has only ever been meant to be used on the
main thread, but that contract was not enforced in any major way. If a store was interacted with
on a background thread a runtime warning would be emitted, but the compiler had no knowledge of
the type's isolation.
That now changes in 1.14 where Store is now officially @MainActor-isolated. This has been
done in a way that should be 100% backwards compatible, and if you have problems please open a
discussion.
However, if you are using strict concurrency settings in your app, then there is one circumstance
in which you may have a compilation error. If you are accessing the store in a view method or
property in Xcode <16, then you may have to mark that property as @MainActor:
struct FeatureView: View {
let store: StoreOf<Feature>
var body: some View {
// ...
}
+ @MainActor
var title: some View {
Text(store.name)
}
}