Skip to main content

Documentation Index

Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

// Update group details
let group = Group(guid: "GUID", name: "New Name", groupType: .public, password: nil)
CometChat.updateGroup(group: group,
    onSuccess: { group in }, onError: { error in })
Update a group’s name, icon, description, or metadata. The GUID and group type cannot be changed after creation. See the Group Class reference for all editable fields.

Update Group

Use updateGroup() to modify group details. Pass a Group object with the updated values.
let GUID = "GUID";
let groupName = "Hello Group!";
let groupType: CometChat.groupType = .public;

let groupTobeUpdated = Group(guid: GUID, name: groupName, groupType: groupType, password: nil)

CometChat.updateGroup(group: groupTobeUpdated, onSuccess: { (group) in

  print("Groups details updated successfully. " + group.stringValue())

}) { (error) in

   print("Group details update failed with error: " + error!.errorDescription);
}
ParameterDescription
groupAn instance of Group class with updated values
On success, returns a Group object with the updated details.

Real-time Events

When a group is updated, all members receive the onGroupUpdated event via CometChatGroupDelegate:
extension YourClass: CometChatGroupDelegate {
    func onGroupUpdated(action: ActionMessage, updatedGroup: Group, updatedBy: User) {
        print("Group updated: \(updatedGroup.name ?? "")")
        print("Updated by: \(updatedBy.name ?? "")")
    }
}

Next Steps

Delete Group

Permanently delete a group

Retrieve Groups

Fetch and filter groups with pagination