Skip to content

iOS Integration

Get Started > Cleardil SDK > iOS Integration

1. Get cocoapods

To integrate the Cleardil SDK in your iOS app, use cocoapods dependency manager available from Cocoapod’s website:

Terminal window
$ sudo gem install cocoapods

2. Get Cleardil iOS sdk Example.
Clone iOS example to get started.

Terminal window
$ git clone https://github.com/ClearDil/cleardil-sdk-ios-example.git

Once you pulled the repo, install dependencies:

Terminal window
$ cd cleardil-sdk-ios-example/iOSExample
$ pod install

This will fetch both Cleardil SDK and Flutter dependencies and create XCode files.
Double click iOSExample.xcworkspace to load the project inside XCode:

Two siblings xcodeproj are present one of them named Pods which contains the dependencies and references of your existing project in Targets > General > Frameworks, Libraries and Embedded Content.

Remember to sign your project with your teams id by going to the Signing and Capabilities tab of project’s settings.

3. Run sample app.
Plug your device select it as target execution device and hit the run button.

Cleardil SDK currently support only mobile device execution .

4. Basic call of Cleardil SDK in your code

Import the KycModule and KycModuleBuilder using import ‘cleardil_kyc_pod’, build and start the sdk as follows:

import cleardil_ios_sdk
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var kycModule : KycModule?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions
launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Instantiate Flutter engine
self.kycModule = KycModuleBuilder()
.withEnvironment(env: KycModule.Environment.SANDBOX)
.allowPassport()
.allowIdentityCard()
.allowDriverLicense()
.withSandboxEnvironment()
.withVerification()
.withSdkToken(sdkToken: “f79a0adc-922b-4a7b-a688-f143a3c4df61”)
.build()
return true
}
}

Remember to update your Info.plist with camera and microphone authorizations as follows:

<key>NSMicrophoneUsageDescription</key>
<string>Explanation on why the microphone access is needed.</string>
<key>NSCameraUsageDescription</key>
<string>Explanation on why the camera access is needed.</string>

4. Advanced call
Cleardil SDK builder allows to customise user experience.
Specify which type of document is available for your clients with theses methods :

allowPassport()
allowIdentityCard()
allowDriverLicense()
withVerification()
withSandboxEnvironment()

Example with the KycModule builder :

KycModule.builder()
.withSdkToken("<yourtoken>")
.withSandboxEnvironment()
.allowIdentityCard()
.allowDriverLicense()
.build()
.start();

This code will instantiate the ClearDil Kyc Module allowing only Id CARD & Driver License.

Not specifying the Allow methods will allow everything.

Congratulations, you are now able to instanciate the Kyc view from your iOS application.