AI Integration Quick Reference
AI Integration Quick Reference
CometChatUsers and CometChatGroups, opened from a button
on the conversations list.
Overview
- A compose button on the conversations list opens the New Chat screen.
- A segmented control switches between Users and Groups; both lists search and page.
- Picking a user opens a one-to-one chat. Picking a public group you have not joined joins it first, then opens it.
Prerequisites
- The Kit is set up and a user is logged in — see Getting Started.
- A chat screen that takes a
Useror aGroup— see Message Privately for one.
Components
Integration Steps
1. Add the entry point to the conversations list
- SwiftUI
- UIKit
ChatsView.swift
2. Build the New Chat screen
Put the two lists behind Users / Groups segments, laid out like the conversations and users lists:- The navigation bar keeps the title and the search field. Each list puts its search in the bar it is shown in.
- The segments are the search field’s scope bar, under the field in the same navigation bar, not a view of your own above or over the list. The bar’s glass and its soft scroll edge are theirs too: the rows scroll under the title, the field and the segments, and fade as they go.
- No background of your own. The list is the screen’s content and runs under the bar.
- SwiftUI
- UIKit
cometChatSearchScopes(_:selection:) gives the shown list’s search field its scope buttons and
tells you which one is selected. Apply it to whichever list is shown, so the bar keeps the
segments across the switch.NewChatView.swift
3. Handle the selection and open the chat
Open the same chat screen your conversations list opens, with theUser or the Group:
- SwiftUI
- UIKit
MessageView is the chat screen from Conversation List + Message View, which hosts the header and the composer over the list.
Implementation Flow
- The compose button presents the New Chat screen.
- The user switches between Users and Groups, searching either.
- A tap closes the screen and hands you the pick.
- You open the chat with that user or group.
Customization Options
- Filter who is listed —
usersRequestBuilder:/set(userRequestBuilder:)andgroupsRequestBuilder:/set(groupsRequestBuilder:), for example only friends or only joined groups. - Rows and states — both lists take view slots and state views; see Users and Groups.
Edge Cases
Feature Matrix
Next Steps
Users
The users list in full
Groups
The groups list in full
Group Chat
Create, join and manage groups
All Guides
Browse the other guides