Documentation Index Fetch the complete documentation index at: https://cometchat-22654f5b-docs-campaigns-service-rest-api.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
// Transfer group ownership
CometChat. transferGroupOwnership ( UID : "NEW_OWNER_UID" , GUID : "GUID" , onSuccess : { success in }, onError : { error in })
Note: Only the current group owner can transfer ownership. The owner must transfer ownership before leaving the group.
Transfer ownership of a group to another member. Only the current owner can do this, and since owners cannot leave their group, you must transfer ownership first if you want to leave. See Leave Group .
Transfer Ownership
Use transferGroupOwnership() to transfer ownership to another group member.
Parameter Description UIDThe UID of the member to become the new owner GUIDThe GUID of the group
let uid = "cometchat-uid-2"
let guid = "cometchat-guid-1"
CometChat. transferGroupOwnership ( UID : uid, GUID : guid, onSuccess : { (success) in
print ( "Ownership transferred: \( success ) " )
}, onError : { (error) in
print ( "Error: \( error ? . errorDescription ) " )
})
On success, the new owner gets admin scope and the previous owner becomes a participant.
Real-Time Ownership Changed Events
Implement onOwnershipChanged() in CometChatGroupDelegate to receive real-time notifications when group ownership changes.
class ViewController : UIViewController , CometChatGroupDelegate {
override func viewDidLoad () {
super . viewDidLoad ()
CometChat. groupdelegate = self
}
func onOwnershipChanged ( group : Group, newOwner : GroupMember) {
print ( "Ownership changed in group: \( group. name ?? "" ) " )
print ( "New owner: \( newOwner. name ?? "" ) " )
}
}
Set delegate in viewDidLoad(): CometChat.groupdelegate = self. Remove delegate when view is dismissed to avoid memory leaks.
Missed Ownership Changed Events
When fetching previous messages, ownership transfers appear as Action messages (a subclass of BaseMessage ).
Field Value/Type Description action"ownershipChanged"The action type actionOnUserThe new owner actionByUserThe previous owner who transferred actionForGroupThe group where change occurred
Next Steps
Leave Group Leave a group after transferring ownership
Change Member Scope Promote or demote group members