AI Integration Quick Reference
AI Integration Quick Reference
Overview
Prerequisites
- The Kit is set up and a user is logged in — see Getting Started.
- A chat screen that takes a
Group.
Integration Steps
1. Bridge the SDK calls
The SDK calls back on its own queue, so bridge each call from anonisolated function.
SDKBox (from CometChatCore) carries an SDK object back to the main actor:
GroupActions.swift
2. Create a group
Create it, then emitgroupCreated so Conversations and Groups show it without a refetch:
- SwiftUI
- UIKit
3. Join a group from the list
A tap on a public group you have not joined joins it under a “Joining Group” alert, emitsmemberJoined, and then calls onItemClick with the joined group. A password group you
have not joined comes to onItemClick unjoined: check hasJoined, ask for the password and
join through the list’s store.
- SwiftUI
- UIKit
GroupsView.swift
onError and nothing else. A successful one emits memberJoined for you.
4. View and manage members
CometChatGroupMembers lists the group’s members with their scope. Its long-press menu and
swipe actions offer Kick, Ban and Change Scope to the people allowed to use them:
the owner over anyone, an admin over moderators and participants, a moderator may kick
participants. The Kit emits the matching events itself.
- SwiftUI
- UIKit
5. Add members
Let the user pick people fromCometChatUsers in multiple selection, add them, and emit
membersAdded with one action message per member — the message list shows an “added” line
for each:
- SwiftUI
- UIKit
AddMembersView.swift
6. Transfer ownership
The owner must hand the group to someone before leaving it. Pick a member in single selection, transfer, and emitownershipChanged:
- SwiftUI
- UIKit
TransferOwnershipView.swift
7. Delete a group
Delete it, then emitgroupDeleted so it leaves Conversations and Groups:
- SwiftUI
- UIKit
CometChat.leaveGroup(GUID:onSuccess:onError:), then
groupLeft(action:user:group:) / ccGroupLeft(action:leftUser:leftGroup:) with an action
message built like the ones in step 5 (action = .left, actionOn yourself).
Implementation Flow
- The user creates or finds a group; a public group is joined on tap.
- The chat opens with
CometChatMessageHeader,CometChatMessageListandCometChatMessageComposergiven the group. - Your group-details screen offers members, add members, transfer ownership, leave and delete.
- Each of your actions emits its event; every list on screen follows.
Error Handling & Edge Cases
Feature Matrix
Next Steps
Groups
The groups list in full
Group Members
Members, scopes and actions
Groups (SDK)
Every group call in the SDK
All Guides
Browse the other guides