Skip to content
Agora with Swift Package Manager Support featured

Agora with Swift Package Manager Support

By Author: Max Cobb In Developer

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:

Agora with Swift Package Manager Support thumbnail 1

Swift Packages from Agora

The following Swift packages are currently available from Agora:

You can also find them in the Swift Package Index: AgoraRtcEngine_iOS and AgoraUIKit_iOS.

Agora now has some macOS packages available:

Prerequisites

  • 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:

Xcode will fetch the code for the specified release straight from GitHub, and any attached xcframeworks (of which AgoraRtcEngine_iOS has a few).

Agora with Swift Package Manager Support 2
Adding Agora’s Swift Package with Xcode

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:

Agora with Swift Package Manager Support 3

Issues

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.

Testing

To see examples for the Agora Video Streaming SDK and Agora UIKit, check the following repository:

Agora with Swift Package Manager Support 4

Conclusion

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.

Other Resources

For more information about building applications using Agora Video and Audio Streaming SDKs, take a look at the Agora Video Call Quickstart Guide and Agora API Reference.

I also invite you to join the Agora Developer Slack community.