Skip to content

Fix Xcode 27 actor isolation build error - #4

Open
ShityLife wants to merge 1 commit into
KthKuang:mainfrom
ShityLife:codex/fix-xcode-27-actor-isolation
Open

Fix Xcode 27 actor isolation build error#4
ShityLife wants to merge 1 commit into
KthKuang:mainfrom
ShityLife:codex/fix-xcode-27-actor-isolation

Conversation

@ShityLife

Copy link
Copy Markdown

Summary

  • replace platform application lifecycle notification properties with their equivalent notification names
  • avoid accessing actor-isolated UIKit/AppKit/WatchKit members from a nonisolated global initializer
  • preserve the existing foreground synchronization behavior on every supported Apple platform

Problem

Xcode 27 Beta fails to compile iCloudKVKey.swift in Swift 6 mode with:

Main actor-isolated default value in a nonisolated context

The failure occurs while initializing willEnterForegroundNotificationName.

Validation

  • swift build succeeds with Xcode 27 Beta and swift-sharing 2.9.1
  • verified in an iOS 27 simulator consumer app build and launch

@KthKuang

Copy link
Copy Markdown
Owner

Thanks for the report and the patch. I can't reproduce this with the current stable toolchain: with Xcode 26.6 in Swift 6 language mode, the package builds cleanly for macOS, iOS, tvOS, and watchOS, and the iOS 26.5 SDK explicitly annotates UIApplicationWillEnterForegroundNotification as NS_SWIFT_NONISOLATED, so accessing it from a nonisolated context is intentional and allowed today.

Since beta SDK annotations are still in flux, I'd rather not work around a diagnostic that may not survive to release. Let's revisit this when Xcode 27 reaches RC: if the error is still present at that point, I'm happy to fix it — though the change will need to be redone on top of current main, since #5 rewrote iCloudKVKey.swift and this branch no longer merges cleanly.

In the meantime, sharing the exact Xcode 27 beta version and the full compiler output would help confirm the diagnosis.

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.

2 participants