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

# Getting Started With CometChat iOS UI Kit

> Install the CometChat iOS UI Kit v6 with Swift Package Manager, initialise it, log in, and pick the SwiftUI or UIKit toolkit.

> [accordion] AI Integration Quick Reference
>
> | Field | Value |
> | - | - |
> | Package | `https://github.com/cometchat/cometchat-uikit-ios.git`, from `6.0.0-beta.1` (Swift Package Manager only) |
> | SwiftUI toolkit | product `CometChatSwiftUI` |
> | UIKit toolkit | product `CometChatUIKit` |
> | Init | `try await CometChatSession.initialize(appID:region:)` — must finish before `login` |
> | Login | `try await CometChatSession.login(uid:authKey:)` — must finish before rendering components |
> | Order | `initialize` → `login` → render. Breaking this order = an empty screen |
> | Auth Key | Development only. Production: `CometChatSession.login(authToken:)` |
> | Calling | Optional. `CometChatSession.initialize(appID:region:enableCalling: true)` |
> | Requirements | iOS 18+, Swift 6, Xcode 26+ |

This guide adds CometChat to an iOS app. Every integration starts the same way — add the package,
initialise, and log in — and then you build the UI with the toolkit you chose.

![The CometChat iOS UI Kit v6 conversation list: avatars, names, last messages, timestamps and unread badges](https://mintcdn.com/cometchat-22654f5b/pWDsskjSUHgot30F/images/ui-kit/ios/v6/override-none.png?fit=max\&auto=format\&n=pWDsskjSUHgot30F\&q=85\&s=52632d9b876614d3adc2ff672fa4795f)

***

## Prerequisites

You need three things from the [CometChat Dashboard](https://app.cometchat.com/):

| Credential | Where to find it |
| - | - |
| App ID | Dashboard → Your App → Credentials |
| Auth Key | Dashboard → Your App → Credentials |
| Region | Dashboard → Your App → Credentials (e.g. `us`, `eu`, `in`) |

You also need:

* Xcode 26 or later
* An iPhone or simulator running iOS 18 or later
* Swift 6

> [!WARNING]
>
> Auth Key is for development only. In production, generate Auth Tokens on your server with the
> [REST API](https://api-explorer.cometchat.com/) and log in with `CometChatSession.login(authToken:)`.
> Never ship an Auth Key in an app binary — anyone who unzips the IPA can log in as any of your users.

***

## Step 1 — Create an iOS Project

1. Open Xcode and choose **File ▸ New ▸ Project…**.
2. Select **iOS ▸ App** and click **Next**.
3. Enter a product name and organization identifier.
4. Choose the interface for your toolkit — **SwiftUI** for the SwiftUI toolkit, **Storyboard** for the
   UIKit toolkit — and **Swift** as the language.
5. Set the target's **Minimum Deployments** to **iOS 18.0**.

***

## Step 2 — Add the Package

The UI Kit ships as one Swift package with a product per toolkit. Add **one** of them.
`CometChatCore`, the CometChat Chat SDK, the Cards SDK and
the Calls SDK resolve with it. The Calls SDK is included even when you don't use calling; see
[Calling](https://www.cometchat.com/docs/ui-kit/ios/v6/calling-integration.md) to leave it out.

1. In Xcode, choose **File ▸ Add Package Dependencies…**.
2. Paste the package URL: `https://github.com/cometchat/cometchat-uikit-ios.git`
3. Set **Dependency Rule** to **Up to Next Major Version** from `6.0.0-beta.1`.
4. Add the product for your toolkit to your app target:

> [tab] SwiftUI
>
> Add **`CometChatSwiftUI`**. It re-exports `CometChatCore`, so
> `import CometChatSwiftUI` is all your SwiftUI files need — plus `import CometChatSDK` where you name
> SDK types such as `User` or `Group`.

> [tab] UIKit
>
> Add **`CometChatUIKit`**. It re-exports `CometChatCore`, so `import CometChatUIKit` is all your UIKit
> files need for the view controllers, `CometChatSession` and the shared types — plus `import CometChatSDK`
> where you name SDK types such as `User` or `Group`.

If you declare dependencies in a `Package.swift` instead:

```swift Package.swift theme={null}
dependencies: [
    .package(url: "https://github.com/cometchat/cometchat-uikit-ios.git", from: "6.0.0-beta.1"),
],
targets: [
    .target(name: "MyApp", dependencies: [
        // ONE of the two toolkits:
        .product(name: "CometChatSwiftUI", package: "cometchat-uikit-ios"),
        // .product(name: "CometChatUIKit", package: "cometchat-uikit-ios"),
    ]),
]
```

> [!NOTE]
>
> v6 is in beta. A rule that starts at `6.0.0-beta.1` includes the pre-releases and moves to `6.0.0` when
> it ships; a rule that starts at `6.0.0` resolves nothing until then.

> [!NOTE]
>
> v6 is distributed through **Swift Package Manager only** — there is no CocoaPods pod. The two toolkits
> are peers over one data layer, not layers you stack: an app uses one of them.

***

## Step 3 — Add Permissions

The composer records voice notes and takes photos, and calls use the microphone and camera. Add these
keys to your target's `Info.plist` (**Target ▸ Info ▸ Custom iOS Target Properties**):

```xml Info.plist theme={null}
<key>NSCameraUsageDescription</key>
<string>Take photos and videos to send.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Record voice messages and join calls.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Pick photos and videos to send.</string>
```

***

## Step 4 — Initialise and Log In

`CometChatSession` is the Kit's entry point in both toolkits. `initialize` sets the app up — and turns
on presence for every user, which the lists need to show online dots — then `login` signs a user in.
Both are `async`, so the order is simply the order you write them in.

> [tab] SwiftUI
>
> Run them from a `.task` on your first view, and render the chat once they finish:
>
> ```swift ContentView.swift theme={null}
> import SwiftUI
> import CometChatSwiftUI
>
> struct ContentView: View {
>     @State private var isReady = false
>     @State private var errorText: String?
>
>     var body: some View {
>         Group {
>             if let errorText {
>                 Text(errorText)
>             } else if isReady {
>                 Text("Logged in") // your chat screen goes here
>             } else {
>                 ProgressView()
>             }
>         }
>         .task {
>             do {
>                 try await CometChatSession.initialize(appID: "APP_ID", region: "REGION")
>                 // The SDK keeps the session across launches — log in only when there is none.
>                 if CometChatSession.loggedInUser == nil {
>                     _ = try await CometChatSession.login(uid: "UID", authKey: "AUTH_KEY")
>                 }
>                 isReady = true
>             } catch {
>                 errorText = error.localizedDescription
>             }
>         }
>     }
> }
> ```

> [tab] UIKit
>
> Run them from your scene delegate, and set the window's root view controller once they finish:
>
> ```swift SceneDelegate.swift theme={null}
> import UIKit
> import CometChatUIKit
>
> final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
>     var window: UIWindow?
>
>     func scene(_ scene: UIScene, willConnectTo session: UISceneSession,
>                options connectionOptions: UIScene.ConnectionOptions) {
>         guard let windowScene = scene as? UIWindowScene else { return }
>         let window = UIWindow(windowScene: windowScene)
>         window.rootViewController = UIViewController() // a blank screen while you log in
>         window.makeKeyAndVisible()
>         self.window = window
>
>         Task {
>             do {
>                 try await CometChatSession.initialize(appID: "APP_ID", region: "REGION")
>                 // The SDK keeps the session across launches — log in only when there is none.
>                 if CometChatSession.loggedInUser == nil {
>                     _ = try await CometChatSession.login(uid: "UID", authKey: "AUTH_KEY")
>                 }
>                 window.rootViewController = UIViewController() // your chat screen goes here
>             } catch {
>                 print("CometChat could not start:", error)
>             }
>         }
>     }
> }
> ```

Replace `APP_ID`, `REGION` and `AUTH_KEY` with your app's credentials and `UID` with a user's ID. Every
new CometChat app comes with test users — `cometchat-uid-1` to `cometchat-uid-5`.

> [!WARNING]
>
> `region` must match the region your app was created in. A mismatch does not fail at `initialize` — it
> fails later, at login, which makes it look like an authentication problem.

> [!NOTE]
>
> To turn on voice and video calling, initialise with `enableCalling: true` —
> `CometChatSession.initialize(appID:region:enableCalling:)`. See
> [Calling Integration](https://www.cometchat.com/docs/ui-kit/ios/v6/calling-integration.md).

***

## Choose Your UI Toolkit

The rest of the integration — showing a screen and customising it — depends on your toolkit. Follow the
guide that matches your project:

> [card] [SwiftUI](https://www.cometchat.com/docs/ui-kit/ios/v6/getting-started-swiftui.md)
>
> Step-by-step integration with `CometChatSwiftUI` views, modifiers and `NavigationStack`

> [card] [UIKit](https://www.cometchat.com/docs/ui-kit/ios/v6/getting-started-uikit.md)
>
> Step-by-step integration with `CometChatUIKit` view controllers, cells and delegates

Not sure which? See [Choose a toolkit](https://www.cometchat.com/docs/ui-kit/ios/v6/overview.md#choose-a-toolkit).

***

## Build Your Own Chat Experience

> [card] [Conversation List + Message View](https://www.cometchat.com/docs/ui-kit/ios/v6/conversation-message-view.md)
>
> A chat list that opens a full-screen chat

> [card] [One-to-One / Group Chat](https://www.cometchat.com/docs/ui-kit/ios/v6/one-to-one-chat.md)
>
> Open a single chat directly

> [card] [Tab-Based Chat](https://www.cometchat.com/docs/ui-kit/ios/v6/tab-based-chat.md)
>
> Chats, Calls, Users and Groups in a tab bar

> [card] [Components](https://www.cometchat.com/docs/ui-kit/ios/v6/components-overview.md)
>
> Every prebuilt component

***

## Next Steps

> [card] [Components Overview](https://www.cometchat.com/docs/ui-kit/ios/v6/components-overview.md)
>
> Browse all prebuilt UI components

> [card] [Theming](https://www.cometchat.com/docs/ui-kit/ios/v6/theming.md)
>
> Customize colors, fonts, and styles

> [card] [Core Features](https://www.cometchat.com/docs/ui-kit/ios/v6/core-features.md)
>
> Chat features included out of the box

> [card] [Troubleshooting](https://www.cometchat.com/docs/ui-kit/ios/v6/troubleshooting.md)
>
> Common issues and fixes


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.