The situation

At the time of writing, Xcode forces you to have a separate git repository for each Swift package if you want to add it as a dependency. It can reside on your hard drive, and you can certainly use a file:// URL, but it still has to be a git repository:

Image for post

One possible way to get around this is to forget about **.xcodeproj **altogether and use the Swift Package Manager for everything, including your final executable. Xcode 11 added support for SwiftPM projects.

Furthermore, you can specify relative dependencies between packages using the file system. No need to mess with specific versions or git tags:

let package = Package(
    name: "MyProduct",
    products: [
        .library(
            name: "MyProduct",
            targets: ["MyProduct"]),
    ],
    dependencies: [
        .package(path: "../MySoundLibrary"),
        .package(path: "../MyGraphicsLibrary")
    ],
    targets: [
        .target(
            name: "Trade",
            dependencies: ["MySoundLibrary","MyGraphicsLibrary"])
    ]
)

#git #swift #package #local #xcode

Using Local Swift Packages in Xcode, Without Making Them Git repos.
30.25 GEEK