IBDesignables Swift Package Manager - Xcode 12

When we try to use a component that is IBDesignable from a library with SwiftPackageManager, the compilation of the designables fails because it is not compatible with tvOS or macOS when it is a library that is only for iOS.

There is no way to specify that an "only" package is compatible with iOS and that the designables work in XCode 12
A Swift package can declare it only supports iOS by using the platforms property in the package manifest. The SupportedPlatforms struct has pre-defined values can declare not only the platform, but specific iOS versions.
I only have iOS, version 12 defined:

// swift-tools-version:5.3
   platforms: [
    .iOS(.v12)
  ]

But when compiling for the designables compiles tvOS.

The module contains xibs that already fail directly when compiling for tvOS. I am using XCode 12 beta

This seems to be still not fixed a bug in XCode?
@edford This is still a bug in latest Xcode. Is the bug recognized?
The problem in Xcode 12.4 still persists, I understand that the Swift.package, if it is not declared if it supports tvOS or another platform it assumes a default value, but having an iPhone emulator selected, it fails because it is not able to compile on tvOS doesn't make sense when the target doesn't support it.

I'm testing with Xcode 12.5 beta to see if it works.

This solution not work: https://developer.apple.com/forums/thread/652558?answerId=618201022#618201022

By default, Xcode assigns a predefined minimum deployment version for each supported platforms unless you configure supported platforms using the platforms API. This predefined deployment version is the oldest deployment target version that the installed SDK supports for a given platform



Still not working in XCode 12.5 :(
This solved my issue: https://stackoverflow.com/a/66334661/879365

The deal is that specifying platforms does not actually prevent Swift Build from trying to compile them, anyway, so we need to bracket platform-specific code in macros.

Yeah, it sucks. It's a kludge.
IBDesignables Swift Package Manager - Xcode 12
 
 
Q