Development Guide (Document Capture)
Document Capture
Instantiate the configuration object. You must pass a reference to your navigation controller.
let config = OkayCamConfig(navigationController: nav)
The configuration object is initialized with default values.
Start the process by calling
start
onOkayCamDoc
class. You can handle the result in the completion handler.
OkayCamDoc.start(
okayCamConfig: config,
license: yourLicense,
{ filePaths, error in
// handle
}
)
You will only either receieve filePaths
or an error
. One will be valid and the other will be nil
.
Configuration
Modifying the configuration object:
let config = OkayCamConfig(navigationController: nav)
config.topLabel.text = "top label text"
config.topLabel.color = .green
config.topLabel.size = 14
config.bottomLabel.text = "bottom label text"
config.bottomLabel.color = .systemPink
config.bottomLabel.size = 20
config.frame.color = .blue
config.frame.size = CGSize(width: 230, height: 100)
config.frame.content = URL(fileURLWithPath: Bundle.main.path(forResource: "image", ofType: "svg")!)
config.showOverlay = false
config.timer.backgroundColor = .magenta
config.timer.textColor = .systemTeal
config.captureBtnColor = .white
config.torchBtnEnabled = false
config.confirmBtnConfig.backgroundColor = .blue
config.confirmBtnConfig.contentColor = .black
config.retakeBtnConfig.backgroundColor = .orange
config.retakeBtnConfig.contentColor = .black
config.captureConfigPair = CaptureConfigPair(
firstPhoto: OkayCamCaptureConfig(
timeOut: 2,
onFlash: false,
onImageQuality: false, // Required for SDK >= 2.0.0
outputPath: myCustomFilePath
),
secondPhoto: OkayCamCaptureConfig(
timeOut: 1,
onFlash: false,
onImageQuality: false, // Required for SDK >= 2.0.0
outputPath: myCustomFilePath
)
)
config.crop = true
config.width = 250
config.imageQuality = 1.0
Properties on OkayCamConfig
:
topLabel
OkayCamLabelConfig(text: "Tap to focus", color: UIColor.white, size: CGFloat(24))
OkayCamLabelConfig
bottomLabel
OkayCamLabelConfig(text: "Please align ID card within frame", color: UIColor.white, size: CGFloat(24))
OkayCamLabelConfig
frame
OkayCamFrameConfig(size: nil, color: .white, content: nil)
OkayCamFrameConfig
showOverlay
true
Bool
timer
OkayCamTimerConfig(backgroundColor: UIColor.black, textColor: UIColor.white)
OkayCamTimerConfig
captureBtnColor
UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0)
UIColor
torchBtnEnabled
false
Bool
confirmBtnConfig
OkayCamBtnConfig(backgroundColor: UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0), contentColor: UIColor.white)
OkayCamBtnConfig
retakeBtnConfig
OkayCamBtnConfig(backgroundColor: UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0), contentColor: UIColor.white)
OkayCamBtnConfig
SDK version 1.1.13 <= or SDK version 1.1.15 >= captureConfigPair
CaptureConfigPair(firstPhoto: OkayCamCaptureConfig(timeOut: 0, onFlash: false, outputPath: nil), secondPhoto: nil)
CaptureConfigPair
crop
false
Bool
width
nil
Int?
imageQuality
1.0 (range 0 - 1.0)
CGFloat
frameSize
nil
Last updated
Was this helpful?