I have files like iOS and macOS storyboards and videos that are specific to iOS or macOS respectively.
All resources that are specific to iOS are in the Sources/iOS, all resources specific to macOS are in the Sources/MacOS and all shared files and resources are under Sources/Shared.
How do I create the package manifest so when I add this to a multi-platform project, only the iOS part compiles to the iOS target and only the macOS part compiles to the macOS target?
I have this manifest
import PackageDescription let package = Package( name: "MyPackage", defaultLocalization: "en", platforms: [ .macOS(.v10_15), .iOS(.v14), ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "MyPackage", targets: ["MyPackage"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "MyPackage", dependencies: [ "SharedTarget", .target(name: "iOSTarget", condition: .when(platforms: [.iOS])), .target(name: "macOSTarget", condition: .when(platforms: [.macOS])), ], path: "Sources" ), .target( name: "SharedTarget", dependencies: , path: "Sources/Shared"), .target( name: "iOSTarget", dependencies: [ "SharedTarget" ], path: "Sources/iOS"), .target( name: "macOSTarget", dependencies: [ "SharedTarget" ], path: "Sources/MacOS"), ] )
but this gives me this error
public headers ("include") directory path for 'iOSTarget' is invalid or not contained in the target
I promise the directories exist and are named correctly.
Another error also shows
Package resolution failed; see package resolution log for details
But Apple "forgot" to tell where this log is...
If I comment all targets except for the shared one, I have this error
Target MyPackage has overlapping sources
This is the directory structure I have.