> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-feature-react-native-sdk-quotedmessage-a.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration

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-feature-react-native-sdk-quotedmessage-a/NKL7tiptE9ywj_6O/images/237ccee2-q6obkhj3ho4tyjyzw7uw49wszuq3tsrihm0gg59nitji64xlzk6df6slj1yu1uad-47b83cd045a26dfb66514a437cef7f3f.png?fit=max&auto=format&n=NKL7tiptE9ywj_6O&q=85&s=479d6552fec8106e11bf8a558a59ce3b" 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-feature-react-native-sdk-quotedmessage-a/c-F07JuWM49qOkUs/images/c0b19786-9yew8luav2m0fotkz1jl5umdws0wp0m9wm5svbfk3fljb6htvs1sy19utpkhboio-cc9b866792207adec092fe89bd02dfe6.png?fit=max&auto=format&n=c-F07JuWM49qOkUs&q=85&s=24c342c424099fa7ef1058cfb869b40d" 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.69'
      pod 'CometChatCallsSDK', '4.2.0'

    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-feature-react-native-sdk-quotedmessage-a/bEkkKJAcvd9ivm_A/images/e100a847-fhfn5g9darizpnc6798cnwds8h11w4khuv5xnnrui3vxcn4jd5opgmas2hw0o8a1-bd9e70be7840d56e71e6f63358afc019.png?fit=max&auto=format&n=bEkkKJAcvd9ivm_A&q=85&s=9feeec1e479ce9a9a66542e293afcbc0" 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-feature-react-native-sdk-quotedmessage-a/8EmfxiO8VFkbp4xi/images/f041182c-5flnsp9djy87b5b6v6miu6u9i6aaedozk7j69pz1r3k4t7d8tv48eqt4vpihutqn-58d01c7c4c9be85298f89ccd1bde4103.png?fit=max&auto=format&n=8EmfxiO8VFkbp4xi&q=85&s=50ecec2115bca7fa42cc1e37dd378e02" 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-feature-react-native-sdk-quotedmessage-a/_lZ5S0KefxAVVFd5/images/15f070c7-08y7nj8l839mqu003fe6s1fg6qeu8pgpa727z3o5eedzkb7rio2tao8yz2ngtjfp-3ddd38e0724b5e4dbee2ee6e87927f2f.png?fit=max&auto=format&n=_lZ5S0KefxAVVFd5&q=85&s=a703db7a5326eec696a64b5314c1a11d" 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.0'

  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>
