How to link local SPM dependencies with iOS/tvOS projects in Xcode 12

Marius Ilie
Jan 25, 2021

I hope I’m not the only one who tried to link local Swift Packages with an existing iOS or tvOS project.

If you try to link paths like “../Common/MyCommonPackageDirectory” in Xcode it will refuse to enable the “Next” button... even there is a valid git in your local directory.

  • My workaround was to add file:// before the actual absolute path. So, instead of using “../Common/MyCommonPackageDirectory” try “file:///Users/myUsername/App/Common/MyCommonPackageDirectory”

Now… I think it’s a bad idea to have absolute paths in Xcode projects. You will definitely hate absolute paths if you want to share your code, to push it or just to move it to another computer.

  • So we should replace “file:///Users/myUsername/App/” part with “../” in our BogusTV.xcodeproj > project.pbxproj

👋 :)

--

--