How can a SPM package be used, ELI5?

I tried to use a GitHub project for a Mac app. tuist install worked, but tuist generate got this error:

:multiply: Error

`libetpan-swift` is not a valid configured external dependency

Sorry this didn’t work. Here’s what to try next:

▸ If the error is actionable, address it

▸ If the error is not actionable, let’s discuss it in the Troubleshooting & how to

▸ If you are very certain it’s a bug, file an issue

▸ Check out the logs at /Users/XXX/.local/state/tuist/logs/7E364807-2D0A-4A4A-9AB3-FF6AAEC99733.log

The log contents were just as clear as the Dependencies page. Let’s step back: if you want to use the project at “https://github.com/slsrepo/libetpan-swift.git”, what parts of the Package.swift and Project.swift need to be altered? I think that the above project builds to a static library (“.a”).

Hey!

Have you read this documentation?

You will need something like:

Tuist/Package.swift:

// swift-tools-version: 5.9
import PackageDescription

let package = Package(
    name: "PackageName",
    dependencies: [
        .package(url: "https://github.com/slsrepo/libetpan-swift", from: "x.y.z"),
    ]
)

Project.swift:

import ProjectDescription

let project = Project(
    name: "App",
    organizationName: "tuist.io",
    targets: [
        .target(
            name: "App",
            destinations: [.iPhone],
            product: .app,
            bundleId: "dev.tuist.app",
            deploymentTargets: .iOS("13.0"),
            infoPlist: .default,
            sources: ["Targets/App/Sources/**"],
            dependencies: [
                .external(name: "ProductYouWant"),  // this needs to be added
            ]
        ),
    ]
)

From the package you sent, the product of the package is actually libetpan, not libetpan-swift, which I assume is where the confusion comes from.

Thanks, so very much