.. _ChapteriOSIntegration: *************** iOS Integration *************** Overview -------- The Face Capture SDK comes with a Swift interface for iOS integration. This chapter will outline the requirements for iOS integration, how to operate the included developer demo, and which parts of the demo source code correspond to the integration tasks outlined in the Application Design chapter. Integration Requirements ------------------------ The Face Capture SDK requires Camera permissions. Demo Operation -------------- The Face Capture SDK comes with a small developer demo that is intended to show how various options work. The demo allows developers to rapidly test various combinations of settings to determine what they need to adjust to meet their own application's requirements. The demo is not intended to resemble a finished product and provides the user with many options that should not be accessible to an end-user in a production environment. Source code for the demo is provided within the SDK installer package. Home Screen ^^^^^^^^^^^ .. _Home Screen: .. figure:: screen_home.png :width: 350px :align: center :height: 600px :alt: alternate text :figclass: align-center Home Screen Settings Screen ^^^^^^^^^^^^^^^ .. _Settings Screen: .. figure:: screen_settings.png :width: 350px :align: center :height: 600px :alt: alternate text :figclass: align-center Settings Screen Capture Screen ^^^^^^^^^^^^^^ .. _Capture Screen: .. figure:: screen_capture.png :width: 350px :align: center :height: 600px :alt: alternate text :figclass: align-center Capture Screen Result Screen ^^^^^^^^^^^^^ .. _Result Screen: .. figure:: screen_result.png :width: 350px :align: center :height: 600px :alt: alternate text :figclass: align-center Result Screen Demo Code --------- This section provides details regarding the Face Capture API and how it is used to implement an application. Create a Face Capture Object ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Create a Face Capture Object* :name: createAFaceCaptureObject let faceCapture = FaceCapture() Create a Workflow Object ^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Create a Workflow Object* :name: createAWorkflowObject try self.workflow = faceCapture.workflowCreate(workflowName: selectedWorkflow) Adjust Workflow Settings ^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Adjust Workflow Settings* :name: adjustWorkflowSettings try self.workflow?.setPropertyString(property: .USERNAME, value: username) try self.workflow?.setPropertyDouble(property: .CAPTURE_TIMEOUT, value: captureTimeout) try self.workflow?.setPropertyString(property: .CAPTURE_PROFILE, value: captureProfile) Select a Camera ^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Select a camera* :name: selectACamera self.cameraList = try faceCapture.getCameraList( position: FaceCapture.CameraPosition.fromString(term: selectedCameraPosition)) self.selectedCamera = self.cameraList[0] try self.selectedCamera?.setOrientation( orientation: FaceCapture.CameraOrientation.fromString(term: selectedCameraOrientation)) Begin a Capture Session ^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Begin a Capture Session* :name: beginACaptureSession try faceCapture.startCaptureSession(workflowHandle: workflow, cameraHandle: camera) Stop a Capture Session ^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Stop a Capture Session* :name: stopACaptureSession try faceCapture.stopCaptureSession() Get the capture region ^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Get capture region* :name: getTheCaptureRegion self.currentCaptureRegion = try faceCapture.captureSessionGetCaptureRegion() Handle Capture Session State ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Capture Session State* :name: captureSessionState self.currentState = try faceCapture.getCaptureSessionState() Handle Capture Session Images ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Capture Session Images* :name: captureSessionImages self.currentFrame = try self.currentState?.getFrame() Handle Capture Session Feedback ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Capture Session Feedback* :name: captureSessionFeedback self.currentFeedback = try self.currentState?.getFeedback() Handle Capture Session Status Changes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Capture Session Status Changes* :name: captureSessionStatusChanges self.currentStatus = try self.currentState?.getStatus() Get the Server Package ^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Get the Server Package* :name: getTheServerPackage self.currentCaptureServerPackage = try faceCapture.getServerPackage( workflowHandle: workflow, packageType: FaceCapture.PackageType.fromString(term: selectedPackageType)) Get the Encrypted Server Package ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Get the Encrypted Server Package* :name: getTheEncryptedServerPackage self.currentCaptureServerPackage = try faceCapture.getEncryptedServerPackage( encryptionType: FaceCapture.EncryptionType.fromString(encryptionType), encryptionKey: encryptionKey, workflowHandle: workflow, packageType: FaceCapture.PackageType.fromString(term: selectedPackageType)) Enable Autocapture ^^^^^^^^^^^^^^^^^^ .. code-block:: JAVA :caption: *Enable Autocapture* :name: enableAutocapture try faceCapture.captureSessionEnableAutocapture(true);