TuIDAddressKit(iOS) SDK v1.1.5

This library makes it possible to capture one image "Address CFE". Send them to TuIdentidadSDK to verify the captured document and issue the result. This document is specifically aimed at technical level users who require information about the TuIdentidad SDK.

Requirements

XCode 11.2.1
IOS 10+
Arquitectura -armv7, arm64
CocoaPods

Project overview

Restrictions and assumptions

1) Cocoapods is used as the manager of this framework.

Previous clarifications

1) The Apikey must be requested with the provider.

Development

TuIdentidadSDK (IOS) was developed in Swift 5 and Xcode 11.2.1.

Cocoapods installation

1) If you are using the default version of Ruby on your Mac, you will have to use the sudo command.

$ gem install cocoapods
$ sudo gem install cocoapods

2) Enter the username and password credentials, this will raise the privileges of the "install" command and allow you to put the files in a protected folder.

Start using Cocoapods with TuIdentidadSDK

AlamoFire helps HTTP requests in Swift.

1) You need an Xcode project to start. Create a project or use an existing one.
2) Close your Xcode project, while Cocoapods is going to make changes to the project.
3) Open the terminal to the location of the folder that belongs to your Xcode project.
4) Enter pod init in the terminal.

$ pod init

Download framework

The text "TuIdentidadSDKDemo" is the name of the solution, the example shown below is the configuration file, necessary to download the framework.

# Uncomment the next line to define a global platform for your project  
platform :ios, '10.0'  
target 'TuIdentidadSDKDemo' do  
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
#TuIdentidad SDKs
  #SDK ADDRES
  pod 'TuIdentidadSDK/AddressKit', '~>1.1.5'
end  

1) Run the Cocoapods installer, it will take some time if it is the first time you install it:

$ pod install

2) Depending on how old your installation is, you may need to use the update command to get the current version. In case you happen to see the following error, check out the Fix problems section below.

Fix problems with Cocoapods

1) Try clearing the cache before you start.
2) Update Cocoapods or try reinstalling it.

Privacy configuration

Add the description of the NSCameraUsageDescription key ("Privacy - Camera Usage Description") in your info.plist file.
ex. 'This app use the camera to validate documents with pictures.'

Using TuIdentidadSDK/AddressKit (TuIDAddressKit)

1) Import TuIdentidadSDK library:

import TuIdentidadSDK

2) Implement the IDAddressDocumentDelegate protocol.

class AddressViewController: UIViewController, IDAddressDocumentDelegate

3) Present the controller for the validation of proof of residence documents.

@IBAction func didValidateIdTouchUpInside(_ sender: Any) {  
    let idAddressViewController = IDAddressViewController()
    idAddressViewController.delegate = self
    idAddressViewController.apiKey = "Your-Api-Key"
    self.present(idAddressViewController, animated: true, completion: nil)
}

The controller returns the result of the validation, it is a function built into the delegate.

    func addressDocumentController(controller: IDAddressViewController, didFinishWithResponse response:   IDAddressDocumentResponse, andImage image: UIImage) {  
        debugPrint(response.valid)  
        debugPrint(response.data)  
    }

    func addressDocumentController(controller: IDAddressViewController, didFinishWithError error: IDErrorResponse, andImage image: UIImage) {  
        debugPrint(error.message)  
        debugPrint(error.code)  
    } 

TuIDAddressKit properties

delegate: The delegate is sent, which in this case would be the controller so that this view listens when the SDK obtains the results.
apikey: Necessary to consume the API of TuIdentidadSDK (request activation with provider).

Example of use of TuIDAddressKit

import UIKit  
import TuIdentidadSDK  
class AddressViewController: UIViewController, IDAddressDocumentDelegate {  
    @IBAction func didValidateIdTouchUpInside(_ sender: Any) {  
        let idAddressViewController = IDAddressViewController()  
        idAddressViewController.delegate = self  
        idAddressViewController.apiKey = "Your-Api-Key"  
        self.present(idAddressViewController, animated: true, completion: nil)  
    }  
    // MARK: - IDAddressDocumentDelegate  
    func addressDocumentController(controller: IDAddressViewController, didFinishWithResponse response:  IDAddressDocumentResponse, andImage image: UIImage) {  
        debugPrint(response.valid)  
        debugPrint(response.data)  
    }  
    func addressDocumentController(controller: IDAddressViewController, didFinishWithError error: IDErrorResponse, andImage image: UIImage) {  
        debugPrint(error.message)  
        debugPrint(error.code)  
    }
}