Skip to content
Ver-ID SDK for iOS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Ver-ID Sample
VerIDModels @ b125fd1
VerIDUI.xcodeproj
VerIDUI.xcworkspace
VerIDUI
docs
.gitignore
.gitmodules
.jazzy.yaml
Podfile
Podfile.lock
README.md
Ver-ID-UI.podspec

README.md

Cocoapods

Ver-ID UI for iOS

Prerequisites

To build this project and to run the sample app you will need a Apple Mac computer with these applications:

Installation

  1. Open Terminal and enter the following commands:

    git clone --recurse-submodules https://github.com/AppliedRecognition/Ver-ID-UI-iOS.git
    cd Ver-ID-UI-iOS
    pod install
    open VerIDUI.xcworkspace
  2. The VerIDUI.xcworkspace should now be open in Xcode.

  3. You can now build and run the Ver-ID Sample target on your iOS device.

Adding Ver-ID to your own project

  1. Request an API secret for your app. We will need your app's bundle ID.

  2. Add the following entry in your app's Info.plist substituting [API secret] for the API secret obtained in step 1:

    <key>com.appliedrec.verid.apiSecret</key>
    <string>[API secret]</string>
  3. Your app's asset bundle must include VerIDModels. Clone the folder using Git instead of downloading the Zip archive. Your system must have Git LFS installed prior to cloning the folder.

    git clone -b matrix-16 https://github.com/AppliedRecognition/Ver-ID-Models.git VerIDModels
  4. Open your project in Xcode. In the top menu go to File / Add Files to "Your project name"... or press ⌥⌘A. Select the cloned VerIDModels folder and tick the toggle Create folder references for any added folders. Press Add.

  5. If your project is using CocoaPods for dependency management, open the project's Podfile. Otherwise make sure CocoaPods is installed and in your project's folder create a file named Podfile (without an extension).

  6. Let's assume your project is called MyProject and it has an app target called MyApp. Open the Podfile in a text editor and enter the following:

    project 'MyProject.xcodeproj'
    workspace 'MyProject.xcworkspace'
    platform :ios, '10.0'
    target 'MyApp' do
    	use_frameworks!
    	pod 'Ver-ID-UI', '~> 1.0.0-beta'
    end
  7. Save the Podfile. Open Terminal and navigate to your project's folder. Then enter:

    pod install
  8. You can now open MyProject.xcworkspace in Xcode and Ver-ID will be available to use in your app MyApp.

Running Ver-ID sessions

  1. Before running a Ver-ID UI session you will need to import the VerIDCore framework and create an instance of VerID.
  2. Have your class implement the VerIDFactoryDelegate protocol. You will receive a callback when the VerID instance is created or when the creation fails.
  3. In the class that runs the Ver-ID session import VerIDUI.
  4. Pass the VerID instance to the VerIDSession constructor along with the session settings.

Example

import UIKit
import VerIDCore
import VerIDUI

class MyViewController: UIViewController, VerIDFactoryDelegate, VerIDSessionDelegate {
    
    func runLivenessDetection() {
        // You may want to display an activity indicator as the instance creation may take up to a few seconds
        let factory = VerIDFactory()
        // Set your class as the factory's delegate
        // The delegate methods will be called when the session is created or if the creation fails
        factory.delegate = self
        // Create an instance of Ver-ID
        factory.createVerID()
    }
    
    // MARK: - Ver-ID factory delegate
    
    func veridFactory(_ factory: VerIDFactory, didCreateVerID instance: VerID) {
        // Ver-ID instance was created
        // Create liveness detection settings
        let settings = LivenessDetectionSessionSettings()
        // Show the result of the session to the user
        settings.showResult = true
        // Create a Ver-ID UI session
        let session = VerIDSession(environment: instance, settings: settings)
        // Set your class as a delegate of the session to receive the session outcome
        session.delegate = self
        // Start the session
        session.start()
    }
    
    func veridFactory(_ factory: VerIDFactory, didFailWithError error: Error) {
        NSLog("Failed to create Ver-ID instance: %@", error.localizedDescription)
    }
    
    // MARK: - Session delegate
    
    func sessionWasCanceled(_ session: VerIDSession) {
        // Session was canceled
    }
    
    func session(_ session: VerIDSession, didFinishWithResult result: VerIDSessionResult) {
        // Session finished successfully
    }
    
    func session(_ session: VerIDSession, didFailWithError error: Error) {
        // Session failed
    }
}

API Reference Documentation

You can’t perform that action at this time.