Physical ID Card Capture

In the storyboard for the ViewController class that will capture the id card, add a CaptureIDCardVideoPreview. CaptureIDCardVideoPreview is a class that is defined in the Smile Identity SDK. It will be used to capture the id card.

To add the CaptureIDCardVideoPreview in the storyboard do the following steps: .

  1. Add a UIView to a ViewController Scene.

  2. Select the UIView, and select CaptureIDCardVideoPreview as the Class. Set the Module to Smile_Identity_SDK, and uncheck the Inherit Module From Target, as the image below shows.

  3. Add the CaptureIDCardVideoPreview as an outlet and name it previewView Make the ViewController be a delegate for the capture selfie callbacks

    class MyIDCardViewController: UIViewController, CaptureSelfieDelegate
  4. Declare a CaptureIDCard variable at the class level

    var captureIDCard : CaptureIDCard?
  5. Override the viewWillAppear function and add the following lines. The previewView is the control that was added the the storyboard. userTag is the custom user tag. In this example, it is send the default user tag value that is defined in the SmileIDSingleton.

    captureIDCard = CaptureIDCard()
    captureIDCardDelegate: self,
    previewView: previewView
    userTag:SmileIDSingleton.DEFAULT_USER_TAG )
    self.view.bringSubview(toFront: previewView)
  6. Override the viewDidAppear function and add the following line.

  7. Override the viewWillAppear function and add the following line.

    OrientationMask.portrait, andRotateTo:
  8. Override the viewWillDisappear function and add the following line.

  9. Implement the CaptureIDCardDelegate callbacks