Is there a way to create a package that is hybrid for multi-platforms?

I have a code that contains classes intended to run on iOS, macOS and tvOS. I have also storyboards on Xcode that are for one platform and the others. I want to convert that into a package.

So I create a new package and drag the files on the source folder of that package.

Here is the problem, how do I mark a file just to be taken into consideration for one specific platform?

Apple has this example where they show you can specify platforms.

let package = Package(
    name: "MyPackage",
    platforms: [
        .macOS(.v10_13), .iOS(.v11), .tvOS(.v11),
    ],

but as expected, their docs do not show how.

Is there a way to do that?

thanks

You can't ship SPM packages with resources like storyboards yet. If you need to do that, CocoaPods gives you the best control over platforms. SPM also can't include files for particular platforms, AFAIK. The platforms values set the deployment target of the package, it's not used to limit the package to particular platforms.

I was starting to suspect that.
Thanks.

Terms of Service

Privacy Policy

Cookie Policy