Swiftpack.co - Package - kycaid/ios-sdk

Official KYCAID iOS SDK

GitHub Logo

Contents

Requirements

  • Xcode 11+
  • iOS 13+

Integration

KYCAID SDK is currently available via:

How to install from Xcode

From Xcode 11, you can use Swift Package Manager to add KYCAID to your project.

  1. Select File > Swift Packages > Add Package Dependency.
  2. Enter https://github.com/kycaid/ios-sdk in the "Choose Package Repository" dialog.
  3. In the next page, specify the version resolving rule as "Branch" with "master". After Xcode checking out the source and resolving the version, you can choose the "KYCAID" library and add it to your app target.

Add dependency:

Xcode Screenshot

Select master:

Xcode Screenshot

Intergrate to your target:

Xcode Screenshot

How to install manually

  1. Download latest xcframework from Releases page.
  2. Drop KYCAIDSDK.xcframework into Frameworks, Libraries and Embedded Content section of Xcode.
  3. Select "Embed and sign".

Add manually:`

Xcode Screenshot

After installation, you could import Kingfisher to your project by adding this:

import KYCAIDSDK

Usage

Setup SDK

Initialize KYCAID instance as early as possible. Grab api token and form identifier from the Dashboard

let sdk = KYCAID(apiToken: "<YOUR API TOKEN>", formId: "<YOUR FORM ID>")

Run verification flow

Once you are done with the setup, you can run verification flow. You must provide content view controller, so SDK is able to show its UI.


//Interface

/// Starts verification process by showing appropriate UI
/// - Parameters:
///   - apiToken: API token. Must be obtained from dashboard
///   - formId: Form identifier. Must be obtained from dashboard
///   - containerViewController: UIViewController which is used as a contanier. KYCAID shows its UI modally using default presentation properties.
///   - completion: Completion that helds the result. Optional
public func startVerification(containerViewController: UIViewController, completion: ((Result<KYCAIDSDK.KYCAID.VerificationInfo, Error>) -> Void)? = nil)

// Usage

sdk.startVerification(containerViewController: self) { result in
    //Handle verification result here
}

Basically, this is all you need to start a verification.

As a result of this call, first verification step should appear:

Further, all required verification steps are about to be open automatically, based on your form setup.

Handle verification result

Once user done with the verification flow, the completion is invoked with VerificationInfo as a result

/// Result structure that is passed into verification completion
public struct VerificationInfo {

    /// Verification identifier.
    public let verificationId: String

    /// Applicant identifier. Optional. Will be nll in case of external verification.
    public let applicantId: String?

    /// Applicant info. Optional. Will be nll in case of external verification.
    public let applicantInfo: KYCAIDSDK.ApplicantInfo?
}

Handle possible errors and cancellation:

If user cancels verification flow, or some error occured, the completion is invoked with Error as a result.

sdk.startVerification(containerViewController: self) { result in
    switch result {
    case .success(let verificationInfo):
        //Handle verificationInfo
    case .failure(let error):
        switch error {
        case KYCAID.SDKError.cancelled:
            //Handle cancellation
        default:
            //Handle generic error
        }
    }
}

Get verification status

Once you have verificationId it's possible to check the verification status.

/// Checks verification state
/// - Parameters:
///   - apiToken: API token. Must be obtained from dashboard
///   - verificationId: The identifier of the verification. See `startVerification` for deails
///   - completion: Completion that helds the result
public func retrieveVerificationState(verificationId: String, completion: @escaping ((Result<KYCAIDSDK.KYCAID.VerificationState, Error>) -> Void))

Notes

SDK uses Camera and Photos Library to make photo verification possible, so next entries shold be added to the Info.plist of your application:

"NSCameraUsageDescription" = "Camera permission is required to create verifications";
"NSPhotoLibraryUsageDescription" = "Library permission is required to create verifications";

Info.plist:

Xcode Screenshot

Screenshots

Localization

KYCAID SDK Supports:

  • English
  • Ukrainian
  • Russian

Todo

  • Example Project

Links

API documentation: https://docs.kycaid.com

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

0.9.1 -

Test Release -