I develop libraries for all Apple platforms (macOS, iOS, tvOS, watchOS). I notice it is impossible to build a library in Xcode when the library scheme is selected and it targets the Apple watch simulator.
You can reproduce the error very easily:
swift package init --type library
Package.swiftfile add any platform/version you support. For example:
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)]
Open with Xcode, select an Apple watch simulator as the scheme target, and try to build.
XCTest is not available when building for watchOS simulator.
It is well know that Apple watch doesn't support
XCTest. However, I am unable to skip the test target uniquely for apple watch builds. Using the conditional compilation
#if !os(watchOS) doesn't solve the problem.
What is the best way to open source a library (containing test targets) which targets all Apple platforms?
Am I missing something? Can my customers include a library in their watchOS apps and try in the simulator without getting build fails?