Joining CocoaPods & Carthage in the iOS engineer’s tool chest for managing project dependencies, Swift Package Manager (or SPM)—Apple’s new dependency manager, is gaining adoption since it became available for iOS in Swift 5/Xcode 11 last year.
With direct integration with Xcode, it’s hard to imagine that Swift Package Manager won’t eventually become the favored approach to integrate third party (or even in-house) libraries.
Button’s Merchant Library—available via CocoaPods & Carthage—is now available on Swift Package Manager as of version 1.3.1.
You can pull in Button Merchant library with SPM directly in Xcode.
- Go to File → Swift Packages → Add Package Dependency.
- Add the GitHub url
- Specify a version rule of Up to Next Major and click Next
- Confirm it's linked to your app target and click Finish.
If you've moved on from managing your own Xcode project and generate your project with SPM, you can add it as a dependency in your
dependencies: [ .package(url: "https://github.com/button/button-merchant-ios", .upToNextMajor(from: "1.3.1")) ]
Let us know how it goes!