Get started

Prerequisite

Before starting DriveKit Group module integration, make sure that you have initialized DriveKit, especially if you have disable the SDK auto-initialization.

Integration

Get framework

To add the Group module to your app:

  • Swift Package Manager: Add DriveKitGroup from repository: https://github.com/DriveQuantPublic/drivekit-sdk-spm.git as dependency.

  • Cocoapods (deprecation scheduled for the end of 2025): add the following pod to your Podfile:

target 'my-target' do
  pod 'DriveKitGroup'
end

Then, run pod install.

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

import DriveKitGroupModule

Synchronise Groups

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

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:

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:

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.

Last updated

Was this helpful?