Initial Integration
Capturing Selfies
Selfie capture sessions are created via a SelfieCaptureSession
and presented by a SelfieCapturePresenter
. To initiate a capture session, you must cover these steps:
Instantiate
SelfieCaptureSession
and configure desired optionsInstantiate
SelfieCapturePresenter
and present the configured SelfieCaptureSessionHandle the result or error callback
import UIKit
import CFSelfieCaptureSDK
class ViewController: UIViewController {
private var selfieCaptureSession: SelfieCaptureSession?
private var selfieCapturePresenter: SelfieCapturePresenter?
private func launchSelfieSDK() {
let options = SelfieCaptureOptions(enableAutoCapture: true, autoCaptureTimeout: 10.0, useFrontCamera: true)
selfieCaptureSession = SelfieCaptureSession(options: options)
selfieCapturePresenter = SelfieCapturePresenter(source: self) { [weak self] result, error in
// handle result
if let result = result {
let selfieImage = result.selfieImage
let selfieImageData = result.selfieImageData
}
}
if let session = selfieCaptureSession {
selfieCapturePresenter?.present(session: session)
}
}
}