> For the complete documentation index, see [llms.txt](https://docs.drivequant.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drivequant.com/group/ios/get-started.md).

# Get started

## **Prerequisite**

Before starting DriveKit Group module integration, make sure that you have [initialized DriveKit](/get-started-drivekit/ios.md), especially if you have [disable the SDK auto-initialization](/get-started-drivekit/ios/advanced-configurations.md#manually-initialize-the-sdk).

{% hint style="danger" %}
If you use DriveKit Group without having initialized DriveKit, the SDK may not work properly in your application.
{% endhint %}

## Integration

### Get framework

To add the Group module to your app using **Swift Package Manager**, add `DriveKitGroup` from repository: `https://github.com/DriveQuantPublic/drivekit-sdk-spm.git` as dependency.

When you need to use the module, just import it in your Swift files:

```swift
import DriveKitGroupModule
```

## Synchronise Groups

To obtain the list of groups that belong to your organisation, call the following method:

```swift
DriveKitGroup.shared.getGroups(synchronizationType: .defaultSync, completionHandler: { (status, groups) in
       // Callback
})
```

`DKGroupsSyncStatus` can have 4 values:

1. `.success`: synchronization has been successfully performed.
2. `.cacheDataOnly`: synchronizationType has been set to cache.
3. `.failedToSyncGroupsCacheOnly`: synchronization has failed, only groups previously synchronized are returned.
4. `.syncAlreadyInProgress`: synchronization is already in progress.

`DKGroupType` can have 3 values:

1. `.all`: Get all groups related to user team.
2. `.joined`: Get already joined groups.
3. `.notJoined`: Get not joined groups related to user team.

## Join Group

To assign the driver to a group, call the following method:

```swift
DriveKitGroup.shared.joinGroup(groupId: "groupId",
                               completionHandler: { status in
    // Callback
})
```

`DKJoinGroupStatus` can have 4 values:

1. `.success`: group joined successfully.
2. `.alreadyJoined`: group already joined.
3. `.groupNotFound`: wrong *groupId*.
4. `.failedToJoin`: failed to join the group.

## Leave Group

To remove the driver from a group to which it has been assigned, call the following method:

```swift
DriveKitGroup.shared.leaveGroup(groupId: "groupId", completionHandler: { status in
     // Callback
})
```

`DKLeaveGroupStatus` can have 4 values:

1. `.success`: left group successfully.
2. `.notInGroup`: user is not in the group.
3. `.groupNotFound`: wrong *groupId*.
4. `.failedToLeave`: failed to leave the group.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.drivequant.com/group/ios/get-started.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
