One of our aims is for you to integrate all Agora SDKs as easily as possible. Four years ago we first added CocoaPods support to Video Call SDK v1.10.0.
Now, we are happy to make integration even easier with Swift Package Manager support. This post shows you how to find and install the latest Swift packages from Agora in your app.
What is Swift Package Manager?
Swift Package Manager (SwiftPM) is a package dependency manager similar to CocoaPods and Carthage. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. SwiftPM is included in Xcode, meaning there is no need to install CocoaPods, run an additional command, or even generate a
*.xcworkspace file to continue with your project.
You can find more information about SwiftPM on the official website:
Swift Packages from Agora
The following Swift packages are currently available from Agora:
Agora now has some macOS packages available:
- An Agora developer account (see How to Get Started with Agora)
- Xcode 11.0 or later
- An iOS device running iOS 8.0 or later
- A basic understanding of iOS development
Add a Package Dependency
Adding a package with SwiftPM is incredibly easy. Everything you need is already integrated with Xcode.
To add dependencies, do the following in Xcode:
- Select File > Swift Packages > Add Package Dependency.
- Enter the GitHub URL for the package. For example: https://github.com/AgoraIO/AgoraRtcEngine_iOS
- Choose the package version (minimum 3.4.5 for SwiftPM Support)
Xcode will fetch the code for the specified release straight from GitHub, and any attached xcframeworks (of which AgoraRtcEngine_iOS has a few).
You can now import
AgoraRtcKit to your project and create your Agora application!
Check out Apple’s doc showing how to add Swift packages to your project:
Xcode sometimes has issues downloading large libraries such as the Agora SDK. If any errors are thrown, in Xcode select File > Swift Packages > Reset Package Caches.
If that does not fix your error, open an issue on GitHub with as much detail as possible, and we’ll try to help you.
To see examples for the Agora Video Streaming SDK and Agora UIKit, check the following repository:
You no longer need to install and run CocoaPods to get Agora up and running in your application. Anyone in your team can open up the Xcode Project file after cloning from your source control system, such as GitHub. The Agora dependency is automatically fetched and included in your working copy.
I also invite you to join the Agora Developer Slack community.