SBSDKBaseScannerViewController

@interface SBSDKBaseScannerViewController : UIViewController

A highly customizable camera view controller that delivers a basic camera functionality along with video frame extraction and preprocessing, orientation correction and still image capturing.

Additionally you can opt-in several features using the SBSDKBaseScannerXXXConfiguration classes, e.g. zooming, energy management and view finder.

This class provides functions to be used and overwritten by subclasses to implement different detectors and recognizers.

  • The ScanbotSDK feature this view controller is used for. Readonly.

    Declaration

    Objective-C

    @property (nonatomic, readonly) dooFeature feature;

    Swift

    var feature: dooFeature { get }
  • Sets or gets the used camera device. Can be used to toggle between the front and back cameras, tele and wide lens.

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) SBSDKCameraDevice *cameraDevice;

    Swift

    var cameraDevice: SBSDKCameraDevice { get set }
  • Returns YES, if the video light is available on the device, NO otherwise.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isFlashLightAvailable;

    Swift

    var isFlashLightAvailable: Bool { get }
  • Enables or disables the video light on the device.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isFlashLightEnabled) BOOL flashLightEnabled;

    Swift

    var isFlashLightEnabled: Bool { get set }
  • A block being called when the flashlight is toggled. Defaults to nil.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(void) flashLightDidChangeHandler;

    Swift

    var flashLightDidChangeHandler: (() -> Void)? { get set }
  • A block being called whenever the view finder rectangle changes. Can be uses to layout UI elements with respect to the view finder position. Defaults to nil.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(CGRect) viewFinderRectDidChangeHandler;

    Swift

    var viewFinderRectDidChangeHandler: ((CGRect) -> Void)? { get set }

    Parameters

    finderRect

    The new view finder rectangle in the coordinate system of the receivers view. Equals to CGRectZero, if the view finder is not active.

  • Set to NO, if you want to stop the recognition. Set to YES otherwise. Make sure that you balance the calls to this properties setter. Setting it twice to NO and only once to YES leaves the recognition still disabled.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite,
              getter=isRecognitionEnabled) BOOL recognitionEnabled;

    Swift

    var isRecognitionEnabled: Bool { get set }
  • Whether the camera permission status is accepted or not. Readonly.

    Declaration

    Objective-C

    @property (readonly) BOOL isCameraUsageAuthorized;

    Swift

    var isCameraUsageAuthorized: Bool { get }
  • Whether the receiver is currently capturing a still image or not. Readonly.

    Declaration

    Objective-C

    @property (readonly) BOOL isCapturingStillImage;

    Swift

    var isCapturingStillImage: Bool { get }
  • Return YES if energy saving currently is active and the recognition runs at a very low rate. Returns NO otherwise.

    Declaration

    Objective-C

    @property (readonly, getter=isEnergySavingActive) BOOL energySavingActive;

    Swift

    var isEnergySavingActive: Bool { get }
  • The current camera zoom factor: a value between 0.0 (the minimum value of the zoom range) and 1.0 (the maximum value of the zoom range).

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat cameraZoomFactor;

    Swift

    var cameraZoomFactor: CGFloat { get }
  • The time interval since the last successful recognition.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSTimeInterval timeIntervalSinceLastSuccessfulRecognition;

    Swift

    var timeIntervalSinceLastSuccessfulRecognition: TimeInterval { get }
  • Returns YES, if focus lock is enabled, NO otherwise. Readonly.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isFocusLockEnabled;

    Swift

    var isFocusLockEnabled: Bool { get }
  • The general configuration of the receiver. Lets you customize some of the basic behaviour. It is copied on setting, so mutating the configuration after setting will not change the behaviour. Instead, re-configure your instance and set it again.

    Declaration

    Objective-C

    @property (nonatomic, copy) SBSDKBaseScannerGeneralConfiguration *_Nonnull generalConfiguration;

    Swift

    @NSCopying var generalConfiguration: SBSDKBaseScannerGeneralConfiguration { get set }
  • The zoom configuration of the receiver. Lets you enable customize the zooming behaviour. It is copied on setting, so mutating the configuration after setting will not change the behaviour. Instead, re-configure your instance and set it again.

    Declaration

    Objective-C

    @property (nonatomic, copy) SBSDKBaseScannerZoomConfiguration *_Nonnull zoomConfiguration;

    Swift

    @NSCopying var zoomConfiguration: SBSDKBaseScannerZoomConfiguration { get set }
  • The energy configuration of the receiver. Lets you enable and customize the energy management. It is copied on setting, so mutating the configuration after setting will not change the behaviour. Instead, re-configure your instance and set it again.

    Declaration

    Objective-C

    @property (nonatomic, copy) SBSDKBaseScannerEnergyConfiguration *_Nonnull energyConfiguration;

    Swift

    @NSCopying var energyConfiguration: SBSDKBaseScannerEnergyConfiguration { get set }
  • The view finder configuration of the receiver. Lets you enable and customize the view finder. It is copied on setting, so mutating the configuration after setting will not change the behaviour. Instead, re-configure your instance and set it again.

    Declaration

    Objective-C

    @property (nonatomic, copy) SBSDKBaseScannerViewFinderConfiguration *_Nonnull viewFinderConfiguration;

    Swift

    @NSCopying var viewFinderConfiguration: SBSDKBaseScannerViewFinderConfiguration { get set }
  • A lazily generated transparent view that can be used to put UI elements too, like user guidance hints.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) UIView *_Nonnull overlayView;

    Swift

    var overlayView: UIView { get }
  • Readonly. Returns YES, if the camera session is currently being interrupted, NO otherwise.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isSessionInterrupted;

    Swift

    var isSessionInterrupted: Bool { get }
  • Not available.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Not available.

    Declaration

    Objective-C

    + (nonnull instancetype)new;
  • Disables auto-focus and locks the lens at the specified lens position.

    Declaration

    Objective-C

    - (BOOL)beginFocusLockAtLensPosition:(CGFloat)lensPosition;

    Swift

    func beginFocusLock(atLensPosition lensPosition: CGFloat) -> Bool

    Parameters

    lensPosition

    The position of the lens. Values can be between 0.0f (minimum focusing distance) and 1.0f (maximum focusing distance). The value will be clamped to [0.0f, 1.0f].

    Return Value

    YES, if the attempt to lock the focus was successful, NO if the attempt failed or if focus lock is not available.

  • Ends the focus lock and returns to standard continous auto-focus.

    Declaration

    Objective-C

    - (void)endFocusLock;

    Swift

    func endFocusLock()
  • Sets the zoom factor to the specified value.

    Declaration

    Objective-C

    - (void)setCameraZoomFactor:(CGFloat)zoomFactor animated:(BOOL)animated;

    Swift

    func setCameraZoomFactor(_ zoomFactor: CGFloat, animated: Bool)

    Parameters

    zoomFactor

    A value between 0.0 (the minimum value of the zoom range) and 1.0 (the maximum value of the zoom range). The zoom range must be specified in the receivers zoomConfigurations zoomRange property. Values outside the (0.0 - 1.0) range will be clipped.

    animated

    Set to YES, if the zooming should be animated, NO otherwise.

  • Resets the zoom factor to the value 0.0: the minimum value of the zoom range specified in the receivers zoomConfigurations zoomRange property.

    Declaration

    Objective-C

    - (void)resetZoom;

    Swift

    func resetZoom()
  • Manually starts energy saving mode.

    Declaration

    Objective-C

    - (void)startEnergySaving;

    Swift

    func startEnergySaving()
  • Manually ends energy saving mode.

    Declaration

    Objective-C

    - (void)endEnergySaving;

    Swift

    func endEnergySaving()
  • Captures a still image asynchronously and passes the JPEG image data as NSData and if needed an error to the completion handler.

    Declaration

    Objective-C

    - (void)captureJPEGStillImageWithCompletionHandler:
        (nullable void (^)(UIImage *_Nullable, NSError *_Nullable))completion;

    Swift

    func captureJPEGStillImage() async throws -> UIImage

    Parameters

    completion

    The completion handler that is called when the still image has been captured.

  • The current rect of the view finder in the coordinate system of the receivers view. If no view finder is active CGRectZero is returned.

    Declaration

    Objective-C

    - (CGRect)currentViewFinderRect;

    Swift

    func currentViewFinderRect() -> CGRect
  • The current rect of the secondary view finder in the coordinate system of the receivers view. If no secondary view finder is active CGRectZero is returned.

    Declaration

    Objective-C

    - (CGRect)currentSecondaryViewFinderRect;

    Swift

    func currentSecondaryViewFinderRect() -> CGRect