I'm developing a watchOS companion app for my iOS app in Xcode 26.0.1 on macOS Sequoia. The watch app uses a simple ObservableObject class with @Published properties for state management, which compiles fine for iOS but fails for the watchOS target.
Error:
Initializer 'init(wrappedValue:)' is not available due to missing import of defining module 'Combine'
Code:
swiftimport SwiftUI
import WatchConnectivity
import Combine // Added explicitly
class WatchConnectivityProvider: NSObject, ObservableObject {
@Published var distance: Double = 0
@Published var isActive: Bool = false
// Additional @Published properties...
}
Environment:
Xcode 26.0.1 (17A400)
macOS Sequoia
watchOS deployment target: 11.0
Apple Watch Series 11 running watchOS 11.6.1
What I've tried:
Adding import Combine explicitly
Cleaning build folder
Verifying target membership
This same code pattern works in the iOS target
Is @Published / Combine supported differently in watchOS under Xcode 26? This code worked in previous Xcode versions. What's the recommended approach for observable state in watchOS apps with Xcode 26?
Selecting any option will automatically load the page