iOS-only SPM targets built against watchOS

316 Views Asked by At

Our project uses several 3rd party packages using Swift Package Manager. Some of them are shared among the iOS and watchOS project, but several packages depend on UIKit, so they are not included in the "Frameworks, Libraries, and Embedded Content" part of the WatchKit Extension target in Xcode project settings.

I can build the iOS or the watchOS app and run in Simulator or on a device, but when I want to preview SwiftUI files included in the watchOS application, building fails.

Xcode build log

What I read from the build log is that Xcode wants to build all of the packages added to the iOS project against watchOS too, which will fail obviously.

Is some of my project settings bad or is this a bug?

1

There are 1 best solutions below

0
axiel7 On

It seems to be an unresolved bug on Xcode 14.

There is an opened discussion on Apple Developer forums