# How do I implement a Swift Package Manager with resources specific to a platform

**URL:** <https://forums.swift.org/t/how-do-i-implement-a-swift-package-manager-with-resources-specific-to-a-platform/66650>\
**Category:** Package Manager\
**Tags:** xcode, packagemanager, macos, ios\
**Created:** [August 8, 2023, 7:55am UTC](https://forums.swift.org/t/how-do-i-implement-a-swift-package-manager-with-resources-specific-to-a-platform/66650 "2023-08-08T07:55:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lunar](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@Lunar](https://forums.swift.org/u/Lunar)\
**Post date:** [August 8, 2023, 7:55am UTC](https://forums.swift.org/t/how-do-i-implement-a-swift-package-manager-with-resources-specific-to-a-platform/66650/1 "2023-08-08T07:55:24Z")

</div>

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

```swift
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.

 ![Screenshot-2023-08-08-at-10.48.43](https://global.discourse-cdn.com/swift/original/3X/c/f/cf397f209a87adf89e176a3914ba5cfa68a5cb66.png)

Thanks
