I've made a little tool to help integrating packages coming from the Swift Package Manager with Xcode projects. It's called xspm and I want to present it to you today.
The project is hosted on GitLab and is open source.
Some of us do this: create a new package of type library, add some dependencies to it and generate an Xcode project. This project is later used as a dependency provider in a target project. You directly gain the opportunity to use the frameworks coming out of this dependency project.
xspm takes care of the setup of such a dependency project and includes it in the target project. It also introduces a new file type to define swift package dependencies. This file is called manifest.xmnfst and it has its own syntax. That syntax is built with simplicity in mind. For example if you want to use
Alamofire in your project just add this line to the manifest file.
+ "https://github.com/Alamofire/Alamofire.git" Alamofire >= 5.0.0-beta.3
You want to use more than one product for a package ? Type this kind of line :
+ "https://github.com/apple/swift-package-manager.git" [SwiftPM, SPMUtility]
It will make
SPMUtility from the
swift-package-manager package available as a dependency in your project.
A typical xspm workflow goes as follow:
- Open a new Terminal window
- Navigate to the target project root
- Enter the command
$ xspm bootstrap
- Edit the freshly created
- Close the target project
- In the terminal enter
$ xspm init
- Open the target project and see that a Dependencies subproject has been added (you can change this name in the manifest).
- Link the dependencies at will.
You can find all the documentation about how to write the manifest file in the xspm repository.
I use xspm in my own project but I think it can be useful for other people. It all started as a script and grew along the months. Now I think it's mature enough for others to use it even if a ton of bugs must be lying around.