Learning about the Swift Package Manager
CocoaPods and Carthage have played a significant part over the years in managing dependencies in iOS projects.
While CocoaPods and Carthage are terrific tools, every platform needs to have its in-house dependency manager, and Apple indeed developed a native dependency manager called the Swift Package Manager (SPM).
So, what is the SPM?
The SPM is a dependency manager built right into Xcode and allows developers to easily create, manage, and share Swift packages, which are self-contained units of code that can be used in different projects. A package can contain one or more targets, each of which is a module that can be imported and used by other packages or projects.
Let’s start creating a Swift package from scratch.
Creating a Swift package
Creating a new Swift package is simple. There are two ways to do it – using the terminal and Xcode:
- Using the terminal: Open the Terminal app, go to the project folder...