Skip to content

Demo of multi-platform Swift Package with platform-specific dependency

Notifications You must be signed in to change notification settings

darrarski/spm-platform-specific-dependecy-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[Demo] Multi-platform Swift Package with platform-specific dependency

swift 5.4 platform iOS & tvOS

This is an example project for Swift Forums thread.

Description

This project contains Swift Package that supports both iOS and tvOS platforms (see Package.swift for details).

There is a single library product built from a single target. This target depends on FirebaseAnalytics.

FirebaseAnalytics is used here as an example of dependency that only supports a single platform - iOS in this case.

Despite adding condition parameter to the target's dependecy:

.target(
  name: "Demo",
  dependencies: [
    .product(
      name: "FirebaseAnalytics",
      package: "Firebase",
      condition: .when(platforms: [.iOS])
    ),
  ]
),

The library product can't be built for tvOS platform, due to an error:

[...]/FirebaseAnalytics.xcframework:1:1: While building for tvOS Simulator, no library for this platform was found in '[...]/FirebaseAnalytics.xcframework'.

The library builds without any issue for iOS platform.

About

Demo of multi-platform Swift Package with platform-specific dependency

Resources

Stars

Watchers

Forks

Languages