> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> CometChat Calling SDK v4 - Stable Release - Setup for iOS

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/DVg4aTljRFe0drLF/images/237ccee2-q6obkhj3ho4tyjyzw7uw49wszuq3tsrihm0gg59nitji64xlzk6df6slj1yu1uad-47b83cd045a26dfb66514a437cef7f3f.png?fit=max&auto=format&n=DVg4aTljRFe0drLF&q=85&s=99771b41bdc18ef95d6e4fd1389d229d" 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/tI1D0nyKUVcz2LEZ/images/c0b19786-9yew8luav2m0fotkz1jl5umdws0wp0m9wm5svbfk3fljb6htvs1sy19utpkhboio-cc9b866792207adec092fe89bd02dfe6.png?fit=max&auto=format&n=tI1D0nyKUVcz2LEZ&q=85&s=9772deaa822e93f380d7fac995cf6b36" 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/udim9ku6wPsRNXGs/images/e100a847-fhfn5g9darizpnc6798cnwds8h11w4khuv5xnnrui3vxcn4jd5opgmas2hw0o8a1-bd9e70be7840d56e71e6f63358afc019.png?fit=max&auto=format&n=udim9ku6wPsRNXGs&q=85&s=75d0bca26a72b5478b2dc7097e6751fa" 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/iII-209mTdOytBSH/images/f041182c-5flnsp9djy87b5b6v6miu6u9i6aaedozk7j69pz1r3k4t7d8tv48eqt4vpihutqn-58d01c7c4c9be85298f89ccd1bde4103.png?fit=max&auto=format&n=iII-209mTdOytBSH&q=85&s=ca3af96a9e5e3ef3a30155dbe74ef705" 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/t35Dbaum6Rkuz_d5/images/15f070c7-08y7nj8l839mqu003fe6s1fg6qeu8pgpa727z3o5eedzkb7rio2tao8yz2ngtjfp-3ddd38e0724b5e4dbee2ee6e87927f2f.png?fit=max&auto=format&n=t35Dbaum6Rkuz_d5&q=85&s=4a95b96ca5552374c3d1d21015843b96" 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
</Tip>

***

## Initialize CometChatProCalls

### 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.

<Tabs>
  <Tab title="Swift">
    ```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()
    ```
  </Tab>

  <Tab title="Objective-C">
    ```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
    ```
  </Tab>
</Tabs>

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

### 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>
