You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@Observable macro fails on Linux: 'shouldNotifyObservers' not covered by macro (Swift 6.2.3) #197
The @Observable macro uses context.makeUniqueName("Member") for generic parameters. On Linux, these generate names starting with $ that look like Swift symbol manglings, which the compiler then rejects.
The macro declaration in Swift properly declares shouldNotifyObservers in its names: parameter:
Can you try the iOS 26 SDK? Macros for system libraries tend to be tightly coupled between the compiler version and the SDK. The iOS 18 SDK probably expects Swift 6.1, and iOS 26 expects 6.2.
Swift 6.2.x's ObservationMacros plugin generates an additional shouldNotifyObservers member, which the SDK's declaration doesn't permit → compile error.
Even after patching the swiftinterface to add named(shouldNotifyObservers) (which fixes compilation), linking fails with:
swift_coroFrameAlloc is a new Swift 6.2 runtime function that doesn't exist in the iOS 18.5 SDK's runtime libraries.
What actually works
Swift 6.1.2 matches the iOS 18.5 SDK perfectly — both compilation and linking succeed. The SDK was built with Swift 6.1.2, so the compiler/SDK pair is fully compatible.
To use Swift 6.2.x
You'd need an iOS 26 SDK (from Xcode 26) which includes:
Updated @Observable macro declaration with shouldNotifyObservers
Swift 6.2 runtime with swift_coroFrameAlloc
Other notes for anyone trying to build a real app with xtool
#Preview macros fail on Linux (PreviewsMacros plugin not available) — wrap with conditional compilation
swift-tools-version: 6.0 enables strict concurrency by default — use .swiftLanguageMode(.v5) in target settings unless your codebase is Swift 6 ready
Swift regex literals (/.../) may fail to parse during cross-compilation — use NSRegularExpression as fallback
-ObjC linker flag is not supported by ld64.lld on Linux
Update: iOS 26.2 SDK (from Xcode 26.2) + Swift 6.2.4 works cleanly.
Followed up on my earlier comment — switching from iOS 18.5 SDK to iOS 26.2 SDK eliminates nearly every workaround:
Issue
iOS 18.5 SDK
iOS 26.2 SDK
@Observable / shouldNotifyObservers
Broken (SDK swiftinterface missing member)
Works natively
swift_coroFrameAlloc linker error
Broken (runtime symbol missing)
Works natively
.allowBluetoothHFP
Missing from SDK
Present in SDK
#Preview macros
Broken (no PreviewsMacros plugin on Linux)
Still broken — platform limitation
Swift regex literals (/.../)
Broken during cross-compilation
Still broken — compiler bug
Only 2 source-level changes needed with iOS 26.2 SDK:
#Preview blocks → wrap with #if !XTOOL_BUILD (113 files in our case, scriptable)
Regex literals → use Regex(#"pattern"#) string constructor instead of /.../ literals (2 files). Same modern Swift Regex API, just avoids the literal parser bug. NSRegularExpression also works but is unnecessary — the bug is only in the literal syntax, not the Regex type.
Note on Xcode versions: Xcode 26.3's SDK ships swiftlang-6.2.3.3.2 which uses ~Copyable suppression syntax not yet in open-source Swift 6.2.4 — use Xcode 26.2 instead.
Build: xtool dev build completes in ~220s for a ~250-file app with 11 dependencies (Firebase, Supabase, Sentry, WebRTC, etc).
Activity
kabiroberai commentedon Jan 25, 2026
Can you try the iOS 26 SDK? Macros for system libraries tend to be tightly coupled between the compiler version and the SDK. The iOS 18 SDK probably expects Swift 6.1, and iOS 26 expects 6.2.
guitaripod commentedon Jan 26, 2026
Update: Found workaround - Swift 6.1 works
After testing, I can confirm that Swift 6.1 does not have this issue. The
@Observablemacro works correctly with Swift 6.1 on Linux.This appears to be a regression in Swift 6.2.x.
However, after getting past this issue with Swift 6.1, I hit another blocker: the Sentry xcframework causes a signing error:
This is tracked in #130. So even with the @observable fix, xtool builds fail if the project uses Sentry.
For now, projects using:
@Observable+ Swift 6.2.x → blocked by this issueI've also filed the underlying Swift bug: swiftlang/swift#86778
amgdev9 commentedon Mar 1, 2026
@guitaripod I tested on swift 6.2.4 and Observable macros work
guitaripod commentedon Mar 2, 2026
Tested this extensively with a real-world app (~250 source files, 11 dependencies including Firebase, Supabase, Sentry, WebRTC).
Swift 6.2.4 does NOT fix
@Observablewith the iOS 18.5 SDK. The issue is the SDK, not the compiler version.Root cause
The iOS 18.5 SDK's
Observation.swiftmoduleswiftinterface was compiled with Swift 6.1.2. The@Observablemacro declaration allows these member names:Swift 6.2.x's
ObservationMacrosplugin generates an additionalshouldNotifyObserversmember, which the SDK's declaration doesn't permit → compile error.Even after patching the swiftinterface to add
named(shouldNotifyObservers)(which fixes compilation), linking fails with:swift_coroFrameAllocis a new Swift 6.2 runtime function that doesn't exist in the iOS 18.5 SDK's runtime libraries.What actually works
Swift 6.1.2 matches the iOS 18.5 SDK perfectly — both compilation and linking succeed. The SDK was built with Swift 6.1.2, so the compiler/SDK pair is fully compatible.
To use Swift 6.2.x
You'd need an iOS 26 SDK (from Xcode 26) which includes:
@Observablemacro declaration withshouldNotifyObserversswift_coroFrameAllocOther notes for anyone trying to build a real app with xtool
#Previewmacros fail on Linux (PreviewsMacrosplugin not available) — wrap with conditional compilationswift-tools-version: 6.0enables strict concurrency by default — use.swiftLanguageMode(.v5)in target settings unless your codebase is Swift 6 ready/.../) may fail to parse during cross-compilation — useNSRegularExpressionas fallback-ObjClinker flag is not supported by ld64.lld on Linuxguitaripod commentedon Mar 2, 2026
Update: iOS 26.2 SDK (from Xcode 26.2) + Swift 6.2.4 works cleanly.
Followed up on my earlier comment — switching from iOS 18.5 SDK to iOS 26.2 SDK eliminates nearly every workaround:
@Observable/shouldNotifyObserversswift_coroFrameAlloclinker error.allowBluetoothHFP#PreviewmacrosPreviewsMacrosplugin on Linux)/.../)Only 2 source-level changes needed with iOS 26.2 SDK:
#Previewblocks → wrap with#if !XTOOL_BUILD(113 files in our case, scriptable)Regex(#"pattern"#)string constructor instead of/.../literals (2 files). Same modern Swift Regex API, just avoids the literal parser bug.NSRegularExpressionalso works but is unnecessary — the bug is only in the literal syntax, not theRegextype.Note on Xcode versions: Xcode 26.3's SDK ships
swiftlang-6.2.3.3.2which uses~Copyablesuppression syntax not yet in open-source Swift 6.2.4 — use Xcode 26.2 instead.Build:
xtool dev buildcompletes in ~220s for a ~250-file app with 11 dependencies (Firebase, Supabase, Sentry, WebRTC, etc).guitaripod commentedon Mar 2, 2026
Consider merging this. It works.