Skip to main content
Version: 4.x.x

Setup - iOS

Setting up iOS SDK​

The iOS SDK is a client for real-time communication on iOS devices. It uses the same terms as the other VideoSDK SDKs.

Minimum OS/SDK versions​

It supports the following OS/SDK versions.

  • iOS 13.0+

Installation​

Use the latest version of Xcode. The SDK supports Swift 5.0+.

Step 1: Add VideoSDK to your Xcode project using Swift Package Manager​

In Xcode, choose File > Add Package Dependencies… and enter the package URL below. Set Dependency Rule to Exact Version 4.0.0, then add the VideoSDKRTCSwift product to your app target.

Package URL
https://github.com/videosdk-live/videosdk-rtc-ios-spm

OR, if your project uses a Package.swift file, add the dependency there:

Package.swift
.package(url: "https://github.com/videosdk-live/videosdk-rtc-ios-spm.git", exact: "4.0.0")

// in your target's dependencies
.product(name: "VideoSDKRTCSwift", package: "videosdk-rtc-ios-spm")
caution
  • 4.x is published only as a Swift package. There is no 4.x CocoaPods release, so pod 'VideoSDKRTC' does not install it.
  • If you already use the package, set its rule to Exact Version 4.0.0. This includes a Branch main rule from the 3.x steps. A rule of Up to Next Major from 3.x never selects 4.0.0.
  • Upgrading from 3.x? Follow the Migration Guide.

Step 2: Add camera and microphone permissions to your app's Info.plist​

info.plist
<key>NSCameraUsageDescription</key>
<string>Allow camera access to start video.</string>

<key>NSMicrophoneUsageDescription</key>
<string>Allow microphone access to start audio.</string>

Step 3: Start using it in your project​

Your code imports VideoSDKRTC, even though the package product is named VideoSDKRTCSwift. createRoom() takes the token as a parameter; there is no separate config step. It throws ERROR_INVALID_PARAMETER for an empty room ID or token, so call it with try.

Start using it in your project
import VideoSDKRTC

var room: Room?

do {
// Create the room with a token fetched from your auth API
room = try VideoSDK.createRoom(
roomId: "<roomId>",
token: "<server token here>",
participantName: "<your name>",
micEnabled: true,
camEnabled: true,
participantId: "<participantId>" // optional
)
} catch {
print("Setup failed: \(error)")
}

Next, call join() on the room. It is async throws, so call it with try await inside a Task. See Creating a Room for every createRoom() parameter.

info

For a full sample app, see videosdk-rtc-ios-example. The example uses iOS SDK 3.x; the Migration Guide lists what changed in 4.0.0.

Got a Question? Ask us on discord