How to Integrate your package module created with Swift Package Manager into your workflow
The following article is part 3 of a 4-part series on modularisation in iOS with Swift Package Manager and some approaches we may take. If you missed out on part 1 or part 2, feel free to check them out. As a reference for examples, we will be using this GitHub Repository
Once we’ve added our new package from part 2 it’s time to integrate it into our workflow. The aim here is to ensure we can build the package separately as this will allow us to develop/iterate quickly and also enable us to perform testing easier.
Build our package in isolation
To build the package in isolation we are free to choose it from our schemes. This will allow us to only compile code related to the package.
Linking our package to our build phase of the main app
Next, To ensure all our packages compile without error when running the main app, we will need to link the binary of the package in our build phases. Head over to Build Phases and select the plus button to Link Binary With Libraries.
Ensure we select the correct package to link.
We can then run the main app and any errors in your package will be flagged at the build phase.
Thank you for taking the time to read this article. Feel free to follow me on Twitter.
Follow up article
In the next part of the series, we’ll look at how we can speed up development by creating an Example App for our module.