Swift 6 concurrency. Apple Watch App target and -disable-dynamic-actor-isolation.

I've got a watch app, still with storyboard, WKInterfaceController and WatchConnectivity.

After updating it for swift 6 concurrency I thought I'd keep it for a little while without swift 6 concurrency dynamic runtime check.

So I added -disable-dynamic-actor-isolation in OTHER_SWIFT_FLAGS, but it doesn't seem to have an effect for the Apple Watch target. Without manually marking callbacks where needed with @Sendable in dynamic checks seem to be in place.

swiftc invocation is as (includes -disable-dynamic-actor-isolation):

swiftc -module-name GeoCameraWatchApp -Onone -enforce-exclusivity\=checked ... GeoCameraWatchApp.SwiftFileList -DDEBUG -enable-bridging-pch -disable-dynamic-actor-isolation -D DEBUG -enable-experimental-feature DebugDescriptionMacro -sdk /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS11.2.sdk -target arm64_32-apple-watchos7.0 -g -module-cache-path /Users/stand/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/stand/Library/Developer/Xcode/DerivedData/speedo-almhjmryctkitceaufvkvhkkfvdw/Index.noindex/DataStore -enable-experimental-feature OpaqueTypeErasure -Xcc -D_LIBCPP_HARDENING_MODE\=_LIBCPP_HARDENING_MODE_DEBUG -swift-version 6
...

-disable-dynamic-actor-isolation flag seems to be working for the iOS targets, I believe.

The flag is described here

Am I missing something? Should the flag work for both iOS and Apple Watch targets?

I would expect it to work regardless of your platform.

Are you sure you applied the setting to the right target? Things can get confusing on watchOS, where you might have both an app and extension target. If your deployment target supports it, you might think about updating, per the advice in TN3157 Updating your watchOS project for SwiftUI and WidgetKit.

Also, I’m curious as to why you’re going down this path. If you don’t want these checks, why use Swift 6 at all? Just switch back to the Swift 5 language mode and you’re all good [1].

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Well, you’re only good if these checks are false positives, but that’s not unheard of.

It’s better to reply as a reply, rather than in the comments; see Quinn’s Top Ten DevForums Tips for this and other titbits.

I wonder when/if staying on swift 5 will become "penalized"

Keep in mind Xcode 16 uses the Swift 6 compiler in all cases. What we’re talking about here is the language mode. When you enable the Swift 6 language mode, the Swift compilers turns concurrency warnings into errors, inserts traps to catch concurrency problems at runtime, and so on.

Language modes tend to be long-lived. For example, the Swift 6 compiler supports the following language modes: 6, 5, 4.2, and 4. So, while I can’t predict the future, I expect that the Swift 5 language mode will be with us for a while.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Swift 6 concurrency. Apple Watch App target and -disable-dynamic-actor-isolation.
 
 
Q