iOS target overrides watchOS despite scheme

Viewed 101

Going through Apple's SwiftUI tutorial but unable to preview watchOS code in the canvas in Xcode 12.0 beta. The offending file has Target Membership for both the iOS and watchOS targets. When setting the scheme to the watch app with an appropriate simulator, #if os(watchOS) returns false.

"Cannot find 'PreviewDetailView' in scope"

iOS-relevant typealias is commented out to show Xcode is still thinking iOS, not watchOS; canvas produces the error Cannot preview in this file — The run destination iPhone 11 Pro Max is not valid for Running the scheme 'WatchLandmarks'.

Unchecking the iOS target in the File Inspector solves the problem, but of course then the file can no longer be used in the iOS app.

Is this expected behaviour? If so, how should I preview watchOS on the canvas without sacrificing iOS target membership? Note that setting .previewDevice(_ value:) to any watch has no effect.

Thank you.

0 Answers
Related