Skip to main content

Identity SDK for iOS

This guide explains how to integrate the Identity SDK into your iOS project.

info

You can find a sample project demonstrating the integration here.

Prerequisites

  • Cocoapods: Make sure you have Cocoapods installed on your machine.

  • Credentials: Make sure you are provided with PKB_PODS_SECRET to integrate Peekaboo Connect Pods.


1. Project Setup

a. Add Env file

Create .pkb-env file in the root of your project to include configs:

PKB_PODS_SECRET=****************************************************

b. Pod Integration

i. Integration through Cocoapods

Configure Pod File
  • Load env in Pod File

Add the following configurations in your app's Podfile file start:

Podfile
require 'dotenv'
Dotenv.load('.pkb-env')
...
note

You can load env in cli before pod install by running source .pkb-env instead of loading in Podfile.

  • Add Pods

Add the following configurations in your app's Podfile file:

PodFile
  pod 'PeekabooConnectCore', :http => "https://pkb-partner-config.peekaboo.guru/asset/download/PeekabooConnectCore.zip?module=PeekabooConnectCore&platform=ios&version=<PKB_CORE_VERSION>&secret="+ENV['PKB_PODS_SECRET']
pod 'FetchskyIdentity', :http => "https://pkb-partner-config.peekaboo.guru/asset/download/FetchskyIdentity.zip?module=FetchskyIdentity&platform=ios&version=<IDENTITY_VERSION>&secret="+ENV['PKB_PODS_SECRET']

PKB_PODS_SECRET is fetched from .pkb-env.

note

Make sure IDENTITY_VERSION is the latest provided version of the sdk. Make sure PKB_CORE_VERSION is always in sync with the version of the identity sdk.

ii. Manual Integration

  • Download Modules from the links

    https://pkb-partner-config.peekaboo.guru/asset/download/PeekabooConnectCore.zip?module=PeekabooConnectCore&platform=ios&version=<PKB_CORE_VERSION>&secret="+ENV['PKB_PODS_SECRET']

    https://pkb-partner-config.peekaboo.guru/asset/download/FetchskyIdentity.zip?module=FetchskyIdentity&platform=ios&version=<IDENTITY_VERSION>&secret="+ENV['PKB_PODS_SECRET']

The core frameworks are mandatory and must be integrated into your project.

Update Info.plist

Add the following configurations in your app's Info.plist file if not already present:

Info.plist
<key>NSCameraUsageDescription</key>
<string>Camera is required for identity verification.</string>

<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

2. Update AppDelegate.swift

Add the following variable in your app's AppDelegate file:

AppDelegate.swift
 var window: UIWindow?

3. Initialize Module

a. Initializing FetchskyIdentity

To initialize the FetchskyIdentity module in your iOS project, follow these steps:

  1. Import frameworks in your view controller:
ViewController.swift
import PeekabooConnectCore // for delegate
import FetchskyIdentity
  1. Conform to the PeekabooConnectControllerDelegate protocol in your view controller:
ViewController.swift
class ViewController: UIViewController, PeekabooConnectControllerDelegate {
// ...
}
  1. Implement the peekabooConnectControllerDidExit(withData:) method to handle the data received from Peekaboo Connect:
ViewController.swift
func peekabooConnectControllerDidExit(withData data: [AnyHashable : Any]) {
// Handle the received data here
print("Received Data From Identity", data["module"]!, data["data"]!)
}
  1. Initialize the FetchskyIdentity module with the desired initial properties:
ViewController.swift
let initialProperties: NSDictionary = [
"fontFamily": "<your-font-family>"
// Add more properties here
]

// initialize view controller
let identityViewController = FetchskyIdentity(initialProperties: initialProperties).ViewController()
identityViewController.delegate = self

// present it as modal
identityViewController.modalPresentationStyle = .fullScreen
present(identityViewController, animated: true)
  1. Run your iOS project and test the integration with Peekaboo Connect Identity.