AI Integration Quick Reference
AI Integration Quick Reference
initialize and login working).
What You’re Building

- Message header — the user’s or group’s name, avatar, and status or member count
- Message list — the chat history, live, with reactions, receipts and threads
- Message composer — text input with attachments, voice notes, stickers and mentions
Step 1: Set Up the Message Screen
- SwiftUI
- UIKit
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’sUser 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
Afterlogin, fetch the other user and show the chat. Replace cometchat-uid-2 with the UID of the user
to chat with.
- SwiftUI
- UIKit
ContentView.swift
Step 4: Launch a Group Chat
For a group, fetch the group instead and pass it asgroup. Every new app has a test group,
cometchat-guid-1; the logged-in user must be a member to see its messages.
- SwiftUI
- UIKit
@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 inInfo.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