Swift Package Manager (SPM) is the dependency manager built into Xcode. You can use it to add the Magnite SDK to your iOS app.
- Xcode 14.0 or later
- iOS 11.0 or later as the deployment target
- In Xcode, open your project and go to File > Add Package Dependencies…
- In the search field at the top right, enter the package URL:
https://github.com/MagniteEngineering/swift-package-manager - Under Dependency Rule, select Up to Next Major Version and enter the latest version (for example,
1.0.6). - In Add to Project, select your project and click Add Package.
- When Xcode finishes resolving the package, select the MagniteSDK library, choose your app target in the Add to Target column and click Add Package.
To check that it worked, open your app target and go to General > Frameworks, Libraries, and Embedded Content. MagniteSDK should appear in the list.
If you are building your own Swift package, add the Magnite SDK to the dependencies of your Package.swift:
dependencies: [
.package(
url: "https://github.com/MagniteEngineering/swift-package-manager.git",
.upToNextMajor(from: "1.0.6")
),
],Then add the product to your target:
targets: [
.target(
name: "YourTarget",
dependencies: [
.product(name: "MagniteSDK", package: "swift-package-manager"),
]
),
]Swift:
import MagniteSDKObjective-C:
@import MagniteSDK;You don't need to link any system frameworks yourself. The package links everything it needs (AdSupport, AppTrackingTransparency, WebKit, StoreKit and others).
- To update to the latest version allowed by your dependency rule, go to File > Packages > Update to Latest Package Versions.
- To move to a new major version, select your project, open the Package Dependencies tab, double-click swift-package-manager and change the version rule.
Select your project in the Project navigator, open the Package Dependencies tab, select swift-package-manager and click the – button.
- "No such module 'MagniteSDK'": check that the MagniteSDK library is added to the right target, then run File > Packages > Reset Package Caches.
- The package won't resolve: make sure you can reach
github.comfrom your machine, then run File > Packages > Resolve Package Versions.
See LICENSE.md.