I am building a library using Swift Package Manager. I have added a XIB file to define the layout of a custom UICollectionViewCell. My package will not compile in Xcode, because the XIB file is specific to iOS. If I create a macOS XIB, then the opposite error occurs. This seems to be because:
- Libraries built by Swift Package Manager will always be cross-platform, and so I can't build an "iOS-only" package.
- Code can use mechanisms like
#if os(iOS)to handle platform-specific code. resources: [ .process("resource.name") ]has noBuildSettingConditionto tell it to include a specific XIB file only when building for iOS..xibis handled automatically by Xcode, without being declared inPackage.swiftbecause it's obvious that they're resource files and so Xcode handles them automatically.xcodebuilddoesn't seem to have rules which separate the two different.xibfiles for platform-specific processing.
What am I missing? How can I ensure that iOS-specific resources are not forced to be included in the final package?
Under the build settings change the target from what ever the value is, to "Any iOS Type"