> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update A Group

> Update group details such as name, type, icon, and description using the CometChat iOS SDK.

<Accordion title="AI Integration Quick Reference">
  ```swift theme={null}
  // 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 })
  ```
</Accordion>

Update a group's name, icon, description, or metadata. The GUID and group type cannot be changed after creation. See the [Group Class](/sdk/ios/create-group#group-class) reference for all editable fields.

## Update Group

Use `updateGroup()` to modify group details. Pass a `Group` object with the updated values.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    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);
    }
    ```
  </Tab>

  <Tab title="Objective C">
    ```objc theme={null}
    NSString *guid = @"cometchat-guid-101";
    NSString *name = @"TestGroup1";
    NSString *password = nil ; // mandatory in case of password protected group type
    NSInteger limit = 30;

    Group *groupToBeUpdated = [[Group alloc]initWithGuid:guid name:name groupType:groupTypePublic password:password];

    [CometChat updateGroupWithGroup:groupToBeUpdated onSuccess:^(Group * group) {

        NSLog(@"Groups details updated successfully. %@",[group stringValue]);

    } onError:^(CometChatException * error) {

        NSLog(@"Group details update failed with error: %@",[error errorDescription]);
    }];
    ```
  </Tab>
</Tabs>

| Parameter | Description                                                                       |
| --------- | --------------------------------------------------------------------------------- |
| `group`   | An instance of [`Group`](/sdk/reference/entities#group) class with updated values |

On success, returns a [`Group`](/sdk/reference/entities#group) object with the updated details.

## Real-time Events

When a group is updated, all members receive the `onGroupUpdated` event via `CometChatGroupDelegate`:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    extension YourClass: CometChatGroupDelegate {
        func onGroupUpdated(action: ActionMessage, updatedGroup: Group, updatedBy: User) {
            print("Group updated: \(updatedGroup.name ?? "")")
            print("Updated by: \(updatedBy.name ?? "")")
        }
    }
    ```
  </Tab>
</Tabs>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Delete Group" icon="trash" href="/sdk/ios/delete-group">
    Permanently delete a group
  </Card>

  <Card title="Retrieve Groups" icon="magnifying-glass" href="/sdk/ios/retrieve-groups">
    Fetch and filter groups with pagination
  </Card>
</CardGroup>
