Suggestions for working on a SPM package and a project it's used in simultaneously

Hi all,

What's a good way to develop a package and test it in a local project it? (Hopefully without pushing up changes to a branch, pulling them back down within the main project, etc).

You can set a local path as dependency in your main project.

1 Like

Example of using a local path:

.package(path: "../MyDevProject"),
1 Like

@afarnhamā€™s example will do it if both projects are packages. If the higherā€level one is an Xcode project (this thread is tagged with xcode), then the same can be accomplished by dragging the package directory into the Xcode project to include it into the same Xcode workspace. The documentation is here.

(Actually, if both projects are packages, there is also $ swift package edit MyDependency, but Iā€™m not sure if Xcode recognizes that yet without the $ swift package generate-xcodeproj strategy.)

2 Likes

Ah, I see. I did forget to mention I was looking for an answer for xcode. Thanks for providing both!