Smile Identity
Search…
⌃K

Physical ID Card Capture

This class is available from version 2.1.0 it's important that the view controller be locked in potrait mode for the best user experience

Setup

The iD Card capture view SIDSmartCardView tries to take the whole screen and has all the views in needs to perform including the guilde layer, torch button and cancel and confirm buttons

Step 1

Add a UIView to the storyboard view controller and give it a custom class SIDSmartCardView from the Smile_Identity_SDK module and snap it to make sure it fills the whole screen.

Step 2

Add the SIDSmartCardView as an outlet to the view controller class

Step 3

Implement the CaptureIDCardDelegate in the view controller and implement the three methods as below and their use case is summarised below
class YourViewController: UIViewController,
CaptureIDCardDelegate {
func onSmartCardViewFrontComplete(previewUIImage: UIImage, faceFound: Bool) {
//called everytime a successful front of id card capture is done
}
func onSmartCardViewBackComplete(previewUIImage: UIImage) {
//called everytime a successful back of id card capture is done
}
func onSmartCardViewError(sidError: SIDError) {
//called when an error occurs during capture
}
func onSmartCardViewClosed() {
//called when the user closes the SmartCardView by pressing the X
}
}

Step 4

Setup the capture by using the view outlet as below
override func viewDidLoad() {
super.viewDidLoad()
sIDSmartCardView.setup(captureIDCardDelegate: self, userTag:<THE_TAG_RELATED_TO_THE_JOB>)
}
Replace <THE_TAG_RELATED_TO_THE_JOB> with a custom unique tag. By default this will bring up the front of ID Capture

Step 5 (Optional)

If there is a need to switch capture after capturing front of id you can listen to changes in the onSmartCardViewFrontComplete method as
func onSmartCardViewFrontComplete(previewUIImage: UIImage, faceFound: Bool) {
idCardView.changeCapture(frontCapture: false)
}