How to link a package locally into my Swift project?

If I have a separate Swift package that I am developing but not ready for publish but I want to try it out in a Swift app can I link that into my project locally or do I always have to push to a git repo and tag with a version to install?

You don't have to push to a git repo. There two ways to link to a package locally

Option 1:

Option 2:

Sorry for bumping the topic, but it seems neither of the two options mentioned above work any longer with Xcode 16, and I wanted to share what worked for me.

I was running into "missing package product" errors when trying to add a local package to my (Mac app) project. It seems there's several wrong ways to add a local package, and only one that worked for me:

  • Select the (app) target
  • On the General tab, scroll down to Frameworks, Libraries, and Embedded Content
  • Click +, "Add Other...", "Add Package Dependency..."
  • "Add Local"
  • Select folder containing Package.swift, and "Add to project: (app project)"
  • "Add to target: (app target)"

Only then will it show up in the Package Dependencies as an expandable folder (not just a single brown box with a link icon).

2 Likes