Overview
The Transfer Group Ownership feature provides a modal interface where the group owner can:- See a list of current group members (excluding themselves)
- Select exactly one member to become the new owner
- Trigger the ownership transfer API call
- Automatically exit the group after successful transfer
Prerequisites
Before implementing ownership transfer, ensure you have:- Completed Getting Started setup
- CometChat UIKit v5+ installed via CocoaPods or Swift Package Manager
- CometChatSDK and CometChatUIKitSwift integrated
- User logged in with
CometChatUIKit.login() UINavigationControlleror modal presentation flow set up- Group context (GUID) available when invoking the transfer screen
Components
Integration Steps
Step 1: Present Transfer Ownership Screen
Show the ownership transfer UI modally:GroupDetailsViewController.swift
Step 2: Configure Single Selection Mode
Restrict selection to one member and capture selection:TransferOwnership.swift
Step 3: Load and Filter Member List
Exclude the current owner from the selectable list:TransferOwnership.swift
Step 4: Perform Ownership Transfer
Call the API, emit event, and exit the group:TransferOwnership.swift
Step 5: Manage Loading State
Provide visual feedback during network calls:TransferOwnership.swift
Complete Implementation
Here’s the completeTransferOwnership class:
Customization Options
Title Text
Replace localization key with custom string:Spinner Style
AdjustspinnerView.style and color using CometChatTheme:
Error Handling
Customize error alerts in theonError closure:
Edge Cases
Error Handling
Feature Matrix
Related Guides
Groups
Display and manage groups
Group Members
View and manage group membership
Group Chat Guide
Complete group management guide