Skip to main content
This guide adds the SwiftUI toolkit to an iOS app. Every component is a SwiftUI view that fetches, paginates and stays live on its own. By the end you have a working chat screen.

Prerequisites

You need your app’s App ID, Auth Key and Region from the CometChat Dashboard (Your App → Credentials), Xcode 26 or later, and an iPhone or simulator running iOS 18 or later.
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.

Step 1 — Create an iOS Project

  1. In Xcode, choose File ▸ New ▸ Project… and select iOS ▸ App.
  2. Enter a product name, and choose SwiftUI for Interface and Swift for Language.
  3. Set the target’s Minimum Deployments to iOS 18.0.

Step 2 — Add the Package

  1. Choose File ▸ Add Package Dependencies… and paste https://github.com/cometchat/cometchat-uikit-ios.git.
  2. Set Dependency Rule to Up to Next Major Version from 6.0.0-beta.1.
  3. Add the CometChatSwiftUI product to your app target.
That is the only dependency you declare. 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. In a Package.swift:
Package.swift
Then add the camera, microphone and photo-library usage descriptions to Info.plist — see Step 3 of Getting Started.

Step 3 — Initialise and Log In

Xcode’s template gives you an App that shows ContentView. Make ContentView initialise the Kit and log in from a .task, and render the chat once both finish. SwiftUI redraws when the state changes, so there are no callbacks to wire:
ContentView.swift
Replace APP_ID, REGION and AUTH_KEY with your credentials, and UID with a user’s ID — every new app has test users cometchat-uid-1 to cometchat-uid-5. Run the app: you see the logged-in user’s conversations, live.
The conversation list the minimal SwiftUI example renders
initialize must finish before login, and login before any component renders — a component that renders first has no session and shows nothing. region must match your app’s region: a mismatch fails at login, not at initialize, which makes it look like an authentication problem.

Step 4 — Choose a Chat Experience

Pick the layout that suits your app. Each guide builds it step by step.

Conversation List + Message View

Sequential navigation — the conversation list is the entry point, and a tap opens a full-screen chat.

Build Conversation List + Message View

CometChatConversations in a NavigationStack, pushing a chat screen

One-to-One / Group Chat

A single chat window with no list. It opens a specific user’s or group’s chat directly — ideal for support chat, direct messages, or notification-driven flows.

Build One-to-One / Group Chat

Header, message list and composer for one chat

Tab-Based Chat

A TabView with Chats, Calls, Users and Groups.

Build Tab-Based Chat

Each tab hosts a CometChat component

Make It Yours

Every part of a screen is replaceable, either as an initialiser argument or as a modifier that cascades to everything below it:
When both are supplied, the initialiser argument wins. The full order is: initialiser argument, then modifier, then theme, then the Kit’s default. See Conversations for the whole surface, and Theming for colours and typography.

Next Steps

Components Overview

Browse all available UI Kit components

Theming

Customize colors, fonts, and styles

Core Features

Chat features included out of the box

Troubleshooting

Common issues and fixes