Customization

You can customize the layout by creating an object of type DocumentDetectorLayout and passing it as a parameter in setLayout(). The DocumentDetectorLayout elements are:

Parameter

Description

Required?

closeButtonImage: UIImage

Icon of close SDK button.

No.

closeButtonColor: UIColor

Color of close SDK button.

No.

closeButtonSize: CGFloat

Size of close SDK button.

No.

closeButtonContentMode: UIView.ContentMode

Content mode of close SDK button.

No.

font: String

Font of all SDK texts.

No.

uploadBackGroundColor: UIColor

Background color for the upload flow.

No.

previewBackGroundColor: UIColor

Background color for the preview screen.

No.

primaryColor: UIColor

Principal color, applied to buttons.

No.

feedbackColors: DocumentFeedbackColors

Colors of the feedback area. All colors have an opacity of 0.4 by default.

No.

Example

let layout = DocumentDetectorLayout()
                        
layout.closeButtonImage = UIImage(named: "my_close_image")
layout.closeButtonColor = .green
layout.closeButtonSize = CGFloat(50)
layout.closeButtonContentMode = .scaleAspectFill

layout.font = "my_font"

layout.primaryColor = .blue
layout.uploadBackGroundColor = .black
layout.previewBackGroundColor = .white

layout.feedbackColors = DocumentFeedbackColors(defaultColor: .black, errorColor: .red, successColor: .green)

let documentDetector = DocumentDetectorSdk.CafBuilder(mobileToken: "mobileToken")
    .setDocumentCaptureFlow(flow: [DocumentDetectorStep(document: Document.CNH_FRONT), DocumentDetectorStep(document: Document.CNH_BACK)])
    .setLayout(layout: layout)
    .build()

Last updated

Logo

2023 © Caf. - All rights reserved