Skip to main content
CometChatGroupMembers lists the members of one group. Each row shows the member’s avatar with a presence dot, their name — “You” on your own row — and a chip for the owner, admins and moderators. Rows offer Scope, Ban and Kick to the people allowed to use them. The list paginates as you scroll, updates in real time and searches the server as you type in its search field.
CometChatGroupMembers showing a group's members with their roles

Where It Fits

CometChatGroupMembers is the screen a group’s details open to show who is in it, and the picker a “mention” or “transfer ownership” flow embeds.
Both toolkits share one store, so the SwiftUI and UIKit lists can never disagree about what to show or who may do what.

Quick Start

That is a working list: it fetches the first 30 members and paginates as you scroll. onItemClick hands you a CometChatSDK.GroupMember.The list draws a system navigation bar, so it brings its own NavigationStack. If your screen already has one, pass embedsNavigationStack: false. The back button is shown by default: it calls onBack, or dismisses the screen when you give none. The search field is in the bar by default; pass hideSearch: true to leave it out.

Filtering Group Members

Both groupMembersRequestBuilder and searchRequestBuilder shape the request from the first page; the default is the group’s guid, 30 a page.
A search runs 0.6 s after the last keystroke, on the search builder — or on the list builder when you give none — and shows one page of results in place of the list. Clearing the field shows the loaded pages again without a request.
searchKeyword puts a keyword in the field, which searches. excludeOwner hides the owner’s row.

Who May Do What

A row’s actions depend on who is looking at it. Nobody is offered an action on their own row, and a moderator cannot ban. Your scope is read from your own row, among the rows on screen. Until that row is loaded — it is on a later page, or a search has filtered it out — you count as a participant and no row offers an action. The owner is recognised by the group’s owner uid, whatever is loaded.
Turn an action off for everyone with disableKick, disableBan or disableChangeScope.

Actions and Events

Callback Methods

Setting onItemLongClick replaces the row’s menu: a long press calls it instead. Setting onItemClick while a selection mode is on means a tap calls it and selects nothing — leave it unset on a picker.

Kick, ban and change scope

Each permitted action appears twice on a row: as a trailing swipe action and in the long-press menu.
  • Kick and Ban ask first, in an alert titled “Kick Alice ?” or “Ban Alice ?” — “Are You sure you want to kick Alice?” — with a destructive Yes and No.
  • Scope opens a sheet listing all three scopes with the member’s current one selected. A scope you may not give — Admin, when you are a moderator — is listed and disabled. Save sends the selected scope, also when it is the one the member already has.
Every dialog closes before its request is sent: the alert on Yes, the sheet on Save. There is no spinner in the sheet.
When an action succeeds the row is removed or updated, and the Kit’s other components are told through CometChatEvents. When it fails, the list is left as it was, onError is called and the error’s message is shown as a snackbar — the Kit’s toast, which the list presents itself from the store’s toast.
A failed page or search calls onError too. The error state, with Retry, is shown only when nothing is loaded.

SDK Events (Real-Time, Automatic)

No wiring required — the store listens and the list updates itself.
A member you have blocked, or who has blocked you, shows no presence dot.

Functionality


Custom View Slots

Every slot is available as an initialiser argument and as a modifier that cascades to every CometChatGroupMembers below it. Supply both and the initialiser argument wins.
Slot closures receive a ChatGroupMember — the row’s value type (id, name, avatarURL, isOnline, scope).
The scope chip stays whatever you supply: a custom tailView is drawn after it and a custom subtitleView under the name. A custom errorView replaces the built-in screen and its Retry; call store.retry() from your own button.

addOptions are shown after the built-in actions. A non-empty options replaces the built-in actions, and addOptions still follows it.

Advanced Methods

Selection

Whenever a selection mode is on, the navigation bar is the selection bar: a discard button with the number selected beside it — from 0 — and a tick; the title stays. Tapping rows fills selected — bind selection to follow each change — and the tick calls onSelection with the selected uids. The selection and the mode stay afterwards. The discard button clears the selection and leaves selection mode; the mode comes back when you pass a different selectionMode.In .single mode a tap replaces the selection, and a second tap on the selected row deselects it. In .multiple mode a tap adds a member or removes a selected one. With furtherSelectionEnabled: false a tap can deselect a member and cannot select another. Changing selectionMode clears the selection, and a member who leaves the list leaves the selection.

Store Access

GroupMembersStore also exposes search(_:), fetchGroupMembers(), retry(), kick(_:), ban(_:), changeScope(_:to:), options(for:), assignableScopes(for:), viewerScope, toast — the snackbar waiting to be shown — and the list operations addItem, insertItem, removeItem, updateItem and clearItems.

Subclassing

CometChatGroupMembers is a View struct. Customise it with its slots, modifiers and style.

Style

Unset properties fall through to the theme, so a style carries only what you change.
On iOS 26 the navigation bar is Liquid Glass and the Kit leaves it to the system. Below iOS 26, or with Reduce Transparency on, the bar is filled with the list’s background. Setting navigationBarBackgroundColor fills it everywhere.
The title, the back button’s glyph and the search field belong to the system’s navigation bar; the style properties for them have no effect.

Next Steps

Groups

The list of groups a member belongs to

Users

The directory of users to add as members

Group Chat

Create, join and manage groups

Component Styling

Style every component