Skip to main content
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

Prerequisites

You need three things from the CometChat Dashboard: You also need:
  • Xcode 26 or later
  • An iPhone or simulator running iOS 18 or later
  • Swift 6
Auth Key is for development only. In production, generate Auth Tokens on your server with the REST API 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 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:
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.
If you declare dependencies in a Package.swift instead:
Package.swift
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.
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):
Info.plist

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.
Run them from a .task on your first view, and render the chat once they finish:
ContentView.swift
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.
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.
To turn on voice and video calling, initialise with enableCalling: true — CometChatSession.initialize(appID:region:enableCalling:). See Calling Integration.

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:

SwiftUI

Step-by-step integration with CometChatSwiftUI views, modifiers and NavigationStack

UIKit

Step-by-step integration with CometChatUIKit view controllers, cells and delegates
Not sure which? See Choose a toolkit.

Build Your Own Chat Experience

Conversation List + Message View

A chat list that opens a full-screen chat

One-to-One / Group Chat

Open a single chat directly

Tab-Based Chat

Chats, Calls, Users and Groups in a tab bar

Components

Every prebuilt component

Next Steps

Components Overview

Browse all prebuilt UI components

Theming

Customize colors, fonts, and styles

Core Features

Chat features included out of the box

Troubleshooting

Common issues and fixes