Skip to main content

Check Scanner UI Components | iOS Document Scanner

The Scanbot SDK provides the ability to recognize checks in a UIImage or CMSampleBufferRef. After successful detection, it runs a recognition operation to extract the data fields of the detected check. The result is encapsulated in an SBSDKCheckRecognizerResult instance.

Supported countries:

  • USA
  • Kuwait
  • Australia
  • France
  • India

Check Scanner UI

There are two ways to integrate the component into the application:

danger

Please be aware that processing really large images may lead to out-of-memory crashes on iOS. Since this limit is highly dynamic and untransparent in iOS, depending on the device, your app's current memory usage, the other running apps, the iOS version, the system configuration and many other unknown variables, we did not add a hard limit for image sizes.

As a general rule of thumb, it is quite safe to assume that processing images of the resolution the camera can shoot will most likely not crash your app. On most modern iOS devices this currently translates to 12 megapixels. But even much larger images may work without crashing as well.

Thus we cannot take responsibility for out-of-memory crashes when dealing with very high-resolution images. It is your responsibility, as an app developer, to properly manage the handling of large images and keep the memory footprint of your app as small as possible.

In case you have any questions on this topic, please reach out to our support team.

caution

Please do not use multiple scanners at the same time. For example, do not combine generic document scanner, health insurance scanner, text data scanner, etc. at the same time! Each scanner instance requires a lot of memory, GPU, and processor resources. Using multiple scanners will lead to performance issues for the entire application.

Ready-To-Use Component

The main class of the Ready-To-Use UI (RTU UI) component is SBSDKUICheckRecognizerViewController

Usually this view controller is used as a separate screen for scanning checks in a UIImage or CMSampleBufferRef. It returns the recognition results in a delegate method.

While you don't have direct control of the actual scanner view controller you can use the SBSDKUICheckRecognizerConfiguration to customize it in a variety of ways, such as colors, texts and behavior.

Usage of the check scanner

import UIKit
import ScanbotSDK

class CheckRecognizerUISwiftViewController: UIViewController {

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

// Start scanning here. Usually this is an action triggered by some button or menu.
self.startScanning()
}

private func startScanning() {

// Create the default configuration object.
let configuration = SBSDKUICheckRecognizerConfiguration.defaultConfiguration

// Behavior configuration:
// e.g. disable capturing the photo to recognize on live video stream
configuration.behaviorConfiguration.captureHighResolutionImage = false

// UI configuration:
// e.g. configure various colors.
configuration.uiConfiguration.topBarBackgroundColor = UIColor.red
configuration.uiConfiguration.topBarButtonsColor = UIColor.white

// Text configuration:
// e.g. customize UI element's text.
configuration.textConfiguration.cancelButtonTitle = "Cancel"

// Present the recognizer view controller modally on this view controller.
SBSDKUICheckRecognizerViewController.present(on: self,
configuration: configuration,
delegate: self)
}
}

extension CheckRecognizerUISwiftViewController: SBSDKUICheckRecognizerViewControllerDelegate {
func checkRecognizerViewController(_ viewController: SBSDKUICheckRecognizerViewController,
didRecognizeCheck result: SBSDKCheckRecognizerResult) {
// Process the recognized result.
}

func checkRecognizerViewControllerDidCancel(_ viewController: SBSDKUICheckRecognizerViewController) {
// Handle dismissing of the recognizer view controller.
}
}

Classic UI Component

The main class of the Classic UI component is SBSDKCheckRecognizerViewController.

Usually, this view controller is embedded as a child view controller into another view controller, the parent view controller. The parent view controller usually acts as the delegate and processes the recognition results. You still have full control over the UI elements and can add additional views and buttons to your view controller. The Classic component does not display results, instead, it just forwards them to the delegate.

import UIKit
import ScanbotSDK

class CheckRecognizerSwiftViewController: UIViewController {

// The instance of the recognizer view controller.
private var recognizerViewController: SBSDKCheckRecognizerViewController?

// The label to present the recognition status updates.
@IBOutlet private var statusLabel: UILabel?

override func viewDidLoad() {
super.viewDidLoad()

// Create the SBSDKCheckRecognizerViewController instance.
self.recognizerViewController = SBSDKCheckRecognizerViewController(parentViewController: self,
parentView: self.view,
delegate: self)
}
}

extension CheckRecognizerSwiftViewController: SBSDKCheckRecognizerViewControllerDelegate {
func checkRecognizerViewController(_ controller: SBSDKCheckRecognizerViewController,
didRecognizeCheck result: SBSDKCheckRecognizerResult) {
// Process the recognized result.
}

func checkRecognizerViewController(_ controller: SBSDKCheckRecognizerViewController,
didChangeState state: SBSDKCheckRecognizerState) {

// Update status label according to status
switch state {
case .searching:
self.statusLabel?.text = "Looking for the check"
case .recognizing:
self.statusLabel?.text = "Recognizing the check"
case .capturing:
self.statusLabel?.text = "Capturing the check"
case .energySaving:
self.statusLabel?.text = "Energy saving mode"
case .paused:
self.statusLabel?.text = "Recognition paused"
@unknown default:
fatalError()
}
}
}

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?