> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-ios-ui-kit-sdk-fixes.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Guide to installing and configuring the CometChat Calls SDK for iOS voice and video calling features.

<Info>
  **Quick Reference for AI Agents & Developers**

  * **SPM:** Add `https://github.com/cometchat/ios-calls-sdk.git` → `CometChatCallsSDK`
  * **CocoaPods:** `pod 'CometChatCallsSDK'`
  * **Import:** `import CometChatCallsSDK`
  * **Init:** `CometChatCalls.init(callsAppSettings:onSuccess:onError:)` — pass `CallAppSettingsBuilder().setAppId(_:).setRegion(_:).build()`
  * **Related:** [Calling Overview](/sdk/ios/calling-overview) · [Ringing](/sdk/ios/default-calling) · [Call Session](/sdk/ios/direct-calling)
</Info>

The **CometChatCalls** is developed to keep developers in mind and aims to reduce development efforts significantly. Let's start to integrate Calls Kit into your project.

***

## Before you begin

Before installing **CometChatCalls for iOS**, you need to create a CometChat application on the CometChat Dashboard, which comprises everything required in a chat service including users, groups, calls & messages. You will need the `App ID` , `AuthKey`, `Region` of your CometChat application when initializing the SDK.

**i. Register on CometChat 🧑💻**

* To install **CometChatCalls for iOS**, you need to first register on **CometChat Dashboard**. [Click here to sign up](https://app.cometchat.com/login).

**ii. Get Your Application Keys 🔑**

* Create a **new app**
* Head over to the **QuickStart** or **API & Auth Keys section** and note the **App ID**, **Auth Key**, and **Region**.

<Tip>
  Each CometChat application can be integrated with a single client app. Within the same application, users can communicate with each other across all platforms, whether they are on mobile devices or on the web.
</Tip>

***

## Prerequisites

The minimum requirements for **CometChatCalls for iOS** are:

* `macOS`
* `Xcode`
* `iOS 13.0 and later`
* `Swift 5.0+`

***

## Get Started

You can start building a modern calling experience in your app by installing UIKit. This developer kit is an add-on feature to CometChat iOS SDK so installing it will also install the core Chat SDK.

***

### Step 1 : Create a project

To get started, open `Xcode` and create a new project.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-ios-ui-kit-sdk-fixes/DAnFVf11tHuQNAiR/images/237ccee2-q6obkhj3ho4tyjyzw7uw49wszuq3tsrihm0gg59nitji64xlzk6df6slj1yu1uad-47b83cd045a26dfb66514a437cef7f3f.png?fit=max&auto=format&n=DAnFVf11tHuQNAiR&q=85&s=7040be5795fd99623bdbfeaadfb38d41" width="734" height="523" data-path="images/237ccee2-q6obkhj3ho4tyjyzw7uw49wszuq3tsrihm0gg59nitji64xlzk6df6slj1yu1uad-47b83cd045a26dfb66514a437cef7f3f.png" />
</Frame>

#### Enter name, identifier and proceed.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-ios-ui-kit-sdk-fixes/sXlOkom3A4PRkute/images/c0b19786-9yew8luav2m0fotkz1jl5umdws0wp0m9wm5svbfk3fljb6htvs1sy19utpkhboio-cc9b866792207adec092fe89bd02dfe6.png?fit=max&auto=format&n=sXlOkom3A4PRkute&q=85&s=651536d1843b7daff03be12b3b648bca" width="734" height="523" data-path="images/c0b19786-9yew8luav2m0fotkz1jl5umdws0wp0m9wm5svbfk3fljb6htvs1sy19utpkhboio-cc9b866792207adec092fe89bd02dfe6.png" />
</Frame>

***

### Step 2 : Install CometChatProCalls Kit

You can install **CometChatCalls for iOS** through **Swift Package Manager or Cocoapods**

### CocoaPods

We recommend using [CocoaPods](https://cocoapods.org/), as they are the most advanced way of managing iOS project dependencies. Open a terminal window, move to your project directory, and then create a `Podfile` by running the following command.

<Tabs>
  <Tab title="Swift">
    ```bash theme={null}
    $ pod init
    ```
  </Tab>
</Tabs>

Add the following lines to the Podfile.

<Tabs>
  <Tab title="Swift">
    ```ruby theme={null}
    platform :ios, '11.0'
    use_frameworks!

    target 'YourApp' do
      pod 'CometChatSDK', '4.0.72'
      pod 'CometChatCallsSDK', '4.2.2'

    end
    ```
  </Tab>
</Tabs>

And then install the `CometChatCalls` framework through CocoaPods.

<Tabs>
  <Tab title="Swift">
    ```bash theme={null}
    $ pod install
    ```
  </Tab>
</Tabs>

If you're facing any issues while installing pods then use the below command.

<Tabs>
  <Tab title="Swift">
    ```bash theme={null}
    $ pod install --repo-update
    ```
  </Tab>
</Tabs>

Always get the latest version of `CometChatCalls` by command.

<Tabs>
  <Tab title="Swift">
    ```bash theme={null}
    $ pod update CometChatCallsSDK
    ```
  </Tab>
</Tabs>

<Info>
  CometChatCallsSDK version `4.0.0` is compatible with `4.0.0` version of CometChatSDK
</Info>

### Swift Package Manager

1. Go to your Swift Package Manager's **File** tab and select **Add Packages**.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-ios-ui-kit-sdk-fixes/2bQYBANP3g7lKLAY/images/e100a847-fhfn5g9darizpnc6798cnwds8h11w4khuv5xnnrui3vxcn4jd5opgmas2hw0o8a1-bd9e70be7840d56e71e6f63358afc019.png?fit=max&auto=format&n=2bQYBANP3g7lKLAY&q=85&s=b473862180a5acca5a688d5f6ed2c1e4" width="690" height="382" data-path="images/e100a847-fhfn5g9darizpnc6798cnwds8h11w4khuv5xnnrui3vxcn4jd5opgmas2hw0o8a1-bd9e70be7840d56e71e6f63358afc019.png" />
</Frame>

2. Add `CometChatProCalls` into your `Package Repository` as below:

<Tabs>
  <Tab title="Swift">
    ```bash theme={null}
    https://github.com/cometchat/ios-calls-sdk.git
    ```
  </Tab>
</Tabs>

3. To add the package, select Version Rules, enter Up to Exact Version, **`4.1.2`**, and click Next.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-ios-ui-kit-sdk-fixes/7RD-XGxZUiwxCGvq/images/f041182c-5flnsp9djy87b5b6v6miu6u9i6aaedozk7j69pz1r3k4t7d8tv48eqt4vpihutqn-58d01c7c4c9be85298f89ccd1bde4103.png?fit=max&auto=format&n=7RD-XGxZUiwxCGvq&q=85&s=ed2296a5678382daf30706b06f082c60" width="1181" height="608" data-path="images/f041182c-5flnsp9djy87b5b6v6miu6u9i6aaedozk7j69pz1r3k4t7d8tv48eqt4vpihutqn-58d01c7c4c9be85298f89ccd1bde4103.png" />
</Frame>

4. Once, the package is added it will look like this.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-ios-ui-kit-sdk-fixes/Pe2cY29NNIuUfdjM/images/15f070c7-08y7nj8l839mqu003fe6s1fg6qeu8pgpa727z3o5eedzkb7rio2tao8yz2ngtjfp-3ddd38e0724b5e4dbee2ee6e87927f2f.png?fit=max&auto=format&n=Pe2cY29NNIuUfdjM&q=85&s=6188df661ef27fa2710ec660dfafd870" width="762" height="364" data-path="images/15f070c7-08y7nj8l839mqu003fe6s1fg6qeu8pgpa727z3o5eedzkb7rio2tao8yz2ngtjfp-3ddd38e0724b5e4dbee2ee6e87927f2f.png" />
</Frame>

### **Cocoa Pods**

Go to root directory. (Where the .xcodeproj reside.) and perform these commands.

<Tip>
  Pod installation

  1. pod init
  2. open -a Xcode Podfile

  Your pod file will open in the text editor. Add your project dependency.

  3. pod 'CometChatCallsSDK', '4.2.2'

  4. For M1 Mac - arch -x86\_64 pod install or For Intel Mac - pod install :::

  ***

  ## Initialize CometChatProCalls[](#initialize-cometchatprocalls "Direct link to Initialize CometChatProCalls")

  ### 1. CallsAppSettings[](#1-callsappsettings "Direct link to 1. CallsAppSettings")

  The `init()` method takes `CallsAppSettings` as a parameter and user can set it by `CallsAppSettingBuilder`. User should be first set the `CallsAppSettings`.

  CallsAppSettings has 3 parameters

  1. `appId` it is mandatory parameter.
  2. `region` It is mandatory parameter.
  3. `host` It is optional parameter.

  * Swift
  * Objective C

  ```swift theme={null}
  #import CometChatProCalls

  let appID = "APP_ID"
  let region = "REGION"
  let host = "HOST"
  let callSettings: CometChatProCalls.CallSettings?

  let callAppSettings = CallAppSettingsBuilder()
              .setAppId(appId)
              .setRegion(region)
              .setHost(host)
              .build()
  ```

  ```objc theme={null}
  @interface ViewController : UIViewController

  @property (nonatomic, strong) CallSetting *callSettings;
  @property (nonatomic, strong) NSString *appId;
  @property (nonatomic, strong) NSString *region;
  @property (nonatomic, strong) NSString *host;

  @end

  @implementation ViewController


  -(void)setupCallsSetting {

     self.callAppSettings = [[[[[CallAppSettingsBuilder new]
                               setAppId:self.appId]
                               setRegion:self.region]
                              setHost:self.host]
                              build];
  }
  @end
  ```

  Note

  Make sure you replace the **appId** with your CometChat *appId* and *region* with your app region in the above code.
</Tip>

### 2. Init() Method

From the above CallAppSettings, pass the settings to the init() method.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    guard let callAppSettings = callAppSettings else { return }

    CometChatCalls.init(callsAppSettings: callAppSettings) { success in
        print("CometChatCalls init success: \(success)")
    } onError: { error in
        print("CometChatCalls init error: \(String(describing: error?.errorDescription))")
    }
    ```
  </Tab>
</Tabs>

<Accordion title="Sample Payloads - Initialize CometChat Calls">
  <Tabs>
    <Tab title="Request">
      **Method:** `CometChatCalls.init(callsAppSettings:onSuccess:onError:)`

      **CallAppSettings Parameters:**

      | Property | Type     | Required | Description             |
      | -------- | -------- | -------- | ----------------------- |
      | appId    | `String` | Yes      | Your CometChat App ID   |
      | region   | `String` | Yes      | App region (us, eu, in) |
      | host     | `String` | No       | Custom host URL         |

      **Example Values:**

      | Property | Value                |
      | -------- | -------------------- |
      | appId    | `"279557705a948ad6"` |
      | region   | `"in"`               |
    </Tab>

    <Tab title="Success Response">
      **Response:**

      | Property | Type     | Value                         |
      | -------- | -------- | ----------------------------- |
      | success  | `String` | `"Initialisation Successful"` |
    </Tab>

    <Tab title="Error Response">
      **Object Type:** CometChatException

      | Property         | Type     | Description                  |
      | ---------------- | -------- | ---------------------------- |
      | errorCode        | `String` | Error identifier             |
      | errorDescription | `String` | Human-readable error message |
    </Tab>
  </Tabs>
</Accordion>
