Skip to main content
A group chat is more than a conversation: people create groups, join them, and the group’s admins manage who is in it. The Kit lists groups and members and handles kick, ban and scope changes itself. Creating a group, adding members, transferring ownership, leaving and deleting are SDK calls on screens you build — after each, you announce it so the Kit’s lists update.

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 a nonisolated function. SDKBox (from CometChatCore) carries an SDK object back to the main actor:
GroupActions.swift

2. Create a group

Create it, then emit groupCreated so Conversations and Groups show it without a refetch:

3. Join a group from the list

A tap on a public group you have not joined joins it under a “Joining Group” alert, emits memberJoined, 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.
GroupsView.swift
A failed join calls 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.

5. Add members

Let the user pick people from CometChatUsers in multiple selection, add them, and emit membersAdded with one action message per member — the message list shows an “added” line for each:
AddMembersView.swift

6. Transfer ownership

The owner must hand the group to someone before leaving it. Pick a member in single selection, transfer, and emit ownershipChanged:
TransferOwnershipView.swift

7. Delete a group

Delete it, then emit groupDeleted so it leaves Conversations and Groups:
Leaving is the same shape: 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

  1. The user creates or finds a group; a public group is joined on tap.
  2. The chat opens with CometChatMessageHeader, CometChatMessageList and CometChatMessageComposer given the group.
  3. Your group-details screen offers members, add members, transfer ownership, leave and delete.
  4. 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