Overview
This guide adds voice and video calling to an app that already uses the iOS UI Kit v6.Complete Getting Started first — the Kit installed, initialised
and a user logged in.
The Calls SDK Comes With the Kit
There is no second package to add. The Kit’s package declares the CometChat Calls SDK (CometChatCallsSDK) itself, so it resolves with https://github.com/cometchat/cometchat-uikit-ios.git
and the call screens are compiled in:
Package.swift
Building the Kit with the environment variable
COMETCHAT_UIKIT_NO_CALLS=1 leaves the Calls
SDK out: the package’s manifest reads it when it is resolved, so it must be set in the
environment of the command that resolves and builds (swift build, xcodebuild). Without
the Calls SDK the Kit has no call screens, and the call buttons show only where your app
handles the tap itself.Turn Calling On
Calling is off by default. PassenableCalling: true when you initialise:
- SwiftUI
- UIKit
initialize also initialises the Calls SDK, and every login logs it in. A
Calls SDK failure is logged and leaves calling off — initialize and login themselves do not
fail. A chat session restored from an earlier launch logs the Calls SDK in too, so turning
calling on in an app whose users are already logged in needs no re-login.
Add the two usage descriptions a call needs to your app’s Info.plist:
Info.plist
Show the Call Buttons
Once calling is on, the voice and video buttons appear in the Message Header:- SwiftUI
- UIKit
The SwiftUI header hides them by default. Show them:
Install a Call Presenter
Without a presenter, each component presents the calls it starts. With one, every call — from the call buttons, the call log, a meeting bubble’s Join, or a call answered from CallKit — appears in one place, and an answered call has somewhere to show:- SwiftUI
- UIKit
Apply it once, at your app’s root: