# iOS SDK

## Requirements

* **iOS 11.0**
* **XCode 10**

![](/files/-Lm7TTt1skMpB-2QCZeq)

## Download SDK & the example project

Download from this [Github link ](https://github.com/josebetomex/mobile_biometric_ios)

## Using the SDK in a new Project

Unzip the file SelfieSDK.framework.zip (Selfie Framework)

```
$unzip SelfieSDK.framework.zip
```

## Copy the file SelfieSDK.framework into your iOS project in XCode

![Drag inside yours frameworks](/files/-LWpjZ-97K6hwZTHnbDd)

![Ensure that is inside Emdded Binaries](/files/-LWpiobmRSMOnqqwSxA_)

![Also in Linked Frameworks](/files/-LWpj5YmE6YXwPkpWaRa)

## Import the Framework in your ViewController

```swift
//Import the framework
import SelfieSDK

// Implement LiveViewControllerDelegate protocol.
class myViewController: UIViewController, LiveViewControllerDelegate {
  //View Controller Code
}

```

## How to use

#### Onboarding

They are 2 ways to onboard users:

1\) Using an official ID with a picture or

2\) Using LiveSelfies

In the first option, Andia makes a comparison of the photo ID against the Selfie that is taken during on-boarding.

In the second option, a Selfie is taken when the user is registered and their biometrics are saved for future validations.

#### Validations

In addition to onboarding, when users use their selfies for transaction or account authorizations, those selfies are then validated to confirm the user is in front of the device. This is an important step that protects against fraudulent selfies.�

## Selfie on-boarding&#x20;

The first step is the creation of a unique identifer for the user. Andia SDK will create a **userId** that will be used in all future validations user Selfies.

To generate a **userId** on a new customer,  Andia will do a on-boarding call to the SDK, with either one of the following options: Selfie or picture of an official ID.

```swift
//Example of Selfie on-boarding call
// Call the doSelfieOnboarding inside of your UIViewController, inside an IBAction by example
let apiKey = "ExampleAPIKEY" //Get your own API KEY in Andia site. 
let selfie = SelfieValidator()
let viewController =  selfie.doSelfieOnboarding(apiKey: apiKey, delegateController: self)
present(viewController, animated: true, completion: nil)        

```

## Document on-boarding (Photo of an official ID)&#x20;

```swift
//Example of Document on-boarding call
// Call the doDocumentOnboarding inside of your UIViewController, inside an IBAction by example
let apiKey = "ExampleAPIKEY" //Get your own API KEY in Andia site. 
let selfie = SelfieValidator()
let viewController =  selfie.doDocumentOnboarding(apiKey: apiKey, delegateController: self)
present(viewController, animated: true, completion: nil)
```

## Selfie Validation

To perform a Selfie Validation against a registered customer **userID**, we first need a registered customer. Then we can call on the SDK to perform a Selfie Validation.

```swift
//Example of Validation call
let selfie = SelfieValidator()
let apiKey = "ExampleAPIKEY" //Get your own API KEY in Andia site.
let viewController = selfie.doValidation(userId: userId!, apiKey: apiKey, delegateController: self)
present(viewController, animated: true, completion: nil)

```

## Callbacks&#x20;

The response from the SDK & On-boarding is through the implementation of the methods of LiveViewControllerDelegate protocol.<br>

```swift
func resultLiveValidation(_ isMatch: Bool?, _ message: String?){
    //your code here      
}
func resultDocumentOnboarding(_ success: Bool?, _ message: String?,_ userId: String?, _ ocr: String?) {
  //your code here
}
func resultSelfieOnboarding(_ success: Bool?, _ message: String?,_ userId: String?) {       
  //your code here
}
//required when the resultDocumentOnboarding is maded 
func resultDocumentOcr(_ success: Bool?, _ nextController: UIViewController?) {
  if (success!){
      present(nextController!, animated: true, completion: nil)
  }
}
```

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://andia.gitbook.io/api/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
