Skip to main content
This guide builds a single chat window — no conversation list. Users go straight into a one-to-one or group chat. Good for support chat, dating apps, or a chat opened from a notification. It assumes you have completed the Getting Started guide for your toolkit (project created, package added, initialize and login working).

What You’re Building

A single chat: messages with reactions, a quoted reply with a thread, a missed call, the New separator, an edited and a deleted message
Three components: the message list fills the screen, and the header and the composer are bars over it, so the rows scroll under their Liquid Glass on iOS 26 and fade softly behind them:
  1. Message header — the user’s or group’s name, avatar, and status or member count
  2. Message list — the chat history, live, with reactions, receipts and threads
  3. Message composer — text input with attachments, voice notes, stickers and mentions

Step 1: Set Up the Message Screen

Create MessageView.swift. The list fills the screen, and the header and the composer are bars over it. The rows scroll under their Liquid Glass on iOS 26 and still come to rest clear of them. Host the bars with safeAreaBar on iOS 26: it also carries the list’s scroll edge effect under each bar, so the rows fade softly behind it. Earlier versions have no edge effect, and safeAreaInset hosts the bars the same way. Stacked in a VStack instead, nothing passes under the bars and the glass has nothing to show.This chat is the whole app, so there is nowhere to go back to — hide the header’s back button:
MessageView.swift

Step 2: Fetch the User or Group

The message components take the SDK’s User or Group, so fetch the one you want to chat with. The Chat SDK’s getUser and getGroup call back on the SDK’s own queue, so wrap them in a type that is not on the main actor — a closure created on the main actor and called from another queue traps under Swift 6’s isolation checks. The same helper serves both toolkits:
ChatLookup.swift
SDKBox (from CometChatCore) carries the SDK object across the queue hop.

Step 3: Launch a One-to-One Chat

After login, fetch the other user and show the chat. Replace cometchat-uid-2 with the UID of the user to chat with.
ContentView.swift

Step 4: Launch a Group Chat

For a group, fetch the group instead and pass it as group. Every new app has a test group, cometchat-guid-1; the logged-in user must be a member to see its messages.
In the full screen, hold the group in @State (SwiftUI) or set the controller as the window’s root (UIKit) exactly as Step 3 does with the user.

Step 5: Run the Project

Build and run. The chat opens straight after login, with the header, the history and the composer. The composer needs the camera, microphone and photo-library usage descriptions in Info.plist — see Step 3 of Getting Started.

Next Steps

Components Overview

Explore all available UI Kit components and their customization options

Theming

Customize colors, fonts, and styles to match your brand

Integration

Back to the main integration guide

Feature Guides

Add capabilities like threaded messages, blocking, and group management