70 %

Toast is in Beta!Learn more →

Chris Biscardi

Swift Package Manager

In the past, iOS had CocoaPods to handle packages for objective-c code. These days, CocoaPods works with Swift and there is also Carthage. CocoaPods and Carthage have some differences themselves and they are both 3rd party package managers.

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

SPM was introduced in Swift 3.0 and has XCode integration.

Adding a dependency

Adding a dependency can be done through XCode and in Package.swift looks something like this:

dependencies: [
url: "https://github.com/Alamofire/Alamofire.git",
.upToNextMajor(from: "5.2.0")

Where to find packages?

Swift Package Index