# 7.1 Create Group

Using `createGroup:groupType:success:failure` method, a new group is created. The group can be either of type GroupTypePublic or GroupTypePrivate. The user creating the group automatically becomes a member of the group, with full authorization for complete group-management functionality for that group. The developer can choose to enforce more fine-grained access controls if desired.+

**Method parameters :**

* **groupName** : Group name(Optional).
* **groupType** : Type of group.
* **success** : Success block to be executed after group is successfully created.
* **failure** : Failure block to be executed if group creation fails, returns `BayunError`.

{% tabs %}
{% tab title="ObjectiveC" %}

```objectivec
[[BayunCore sharedInstance] createGroup:@"groupName" groupType:GroupTypePublic success:^{
     NSLog(@"Group created successfully.");
 } failure:^(BayunErrorbayunError) {
    NSLog(@"Error creating group.");
 }];
```

{% endtab %}

{% tab title="Swift" %}

```swift
BayunCore.sharedInstance().createGroup("groupName", groupType: .public, success: {
    NSLog("Group created successfully.")
}, failure: { (bayunErrorCode) in
    NSLog("Error creating group.")           
})
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bayun.gitbook.io/bayuncoresdk-ios/6-groups/6.1-create-group.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
