Before starting DriveKit Challenge module integration, make sure that you have initialized DriveKit, especially if you have disable the SDK auto-initialization.
If you use DriveKit Challenge without having initialized DriveKit, the SDK may not work properly in your application.
To add the Challenge module to your app:
Swift Package Manager: Add DriveKitChallenge
from repository: https://github.com/DriveQuantPublic/drivekit-sdk-spm.git
as dependency.
Cocoapods: add the following pod to your Podfile:
Then, run pod install
.
To synchronize the list of challenges, call the following method:
ChallengesSyncStatus and DKChallenge models are described in the References part.
You can retrieve the list of challenges stored in the DriveKit local database by calling the previous method but with the SynchronizationType
parameter to .cache
.
You need to call the following method if you want to get more details and statistics about a defined challenge:
This method have the following parameters:
challengeId
String
Unique identifier of the challenge
synchronizationType
SynchronizationType
Can be .defaultSync
or .cache
.
- .defaultSync
will synchronize the challenge detail by calling the DriveQuant servers
- .cache
will retrieve the challenge detail already synchronized in the local database.
ChallengeDetailSyncStatus and DKChallengeDetail models are described in the References part.
You can retrieve the details of a given challenge stored in the DriveKit local database by calling the previous method but with the SynchronizationType
parameter to .cache
.
To be able to join a given challenge, you can call the following method:
This method have the following parameter:
challengeId
String
Unique identifier of the challenge
JoinChallengeSyncStatus enum values are described in the References part.