Call Kit
  • iOS : Swift
  • Android
  • Web
  • Flutter
  • React Native
  • Overview
  • Quick start
  • Custom prebuilt UI

Quick start

Last updated:2022-09-26 10:50

Integrate the SDK

Add ZegoUIKitPrebuiltCall as dependencies

  • Open Terminal, navigate to your project's root directory, and run the following to create a podfile:
    pod init
  • Edit the Podfile file to add the basic dependency:
    pod 'ZegoUIKitPrebuiltCall'
  • In Terminal, run the following to download all required dependencies and SDK with Cocoapods:
    pod install

Import ZegoUIKitSDK & ZegoUIKitPrebuiltCall to your project

import ZegoUIKitSDK
import ZegoUIKitPrebuiltCall
// YourViewController.swift
class ViewController: UIViewController {
    //Other code...
}

Using the ZegoUIKitPrebuiltCallVC in your project

  • Go to ZEGOCLOUD Admin Console, get the appID and appSign of your project.
  • Specify the userID and userName for connecting the Call Kit service.
  • Create a callID that represents the call you want to make.
  • userID and callID can only contain numbers, letters, and underlines (_).
  • Users that join the call with the same callID can talk to each other.
// YourViewController.swift
class ViewController: UIViewController {
    // Other code...
    var userID: String = <#UserID#>
    var userName: String = <#UserName#>
    var callID: String = <#CallID#>

    @IBAction func makeNewCall(_ sender: Any) {

        // You can also use groupVideo/groupVoice/oneOnOneVoice to make more types of calls.
        let config: ZegoUIKitPrebuiltCallConfig = ZegoUIKitPrebuiltCallConfig(.oneOnOneVideoCall)

        let callVC = ZegoUIKitPrebuiltCallVC.init(yourAppID, 
                                                  appSign: yourAppSign, 
                                                  userID: self.userID, 
                                                  userName: self.userName, 
                                                  callID: self.callID, 
                                                  config: config)
        callVC.modalPresentationStyle = .fullScreen
        self.present(callVC, animated: true, completion: nil)
    }
}

Then, you can make a new call by presenting the VC.

Configure your project

Open the Info.plist, add the following code inside the dict part:

<key>NSCameraUsageDescription</key>
<string>We require camera access to connect to a call</string>
<key>NSMicrophoneUsageDescription</key>
<string>We require microphone access to connect to a call</string>

/Pics/ZegoUIKit/iOS/add_mic_camera_permissions.png

Run & Test

Now you have finished all the steps!

You can simply click the Run in XCode to run and test your App on your device.

Custom prebuilt UI

Resources