GSKCameraSession

@interface GSKCameraSession : NSObject

The GSKCameraSession class manages the interactions with the device camera.

  • Declaration

    Objective-C

    - (nonnull instancetype)initWithConfiguration:
        (nonnull GSKCameraSessionConfiguration *)configuration;

    Swift

    init(configuration: GSKCameraSessionConfiguration)

    Parameters

    configuration

    The configuration for the camera session

  • Controls when the video session starts and stops delivering photos

    Declaration

    Objective-C

    - (void)startSessionOnComplete:(nonnull void (^)(void))onComplete;

    Swift

    func start(onComplete: @escaping () -> Void)
  • Sets focus point.

    Declaration

    Objective-C

    - (void)focusAtPoint:(CGPoint)focusPoint;

    Swift

    func focus(at focusPoint: CGPoint)
  • Change the flash status.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite)
        GSKCameraSessionFlashStatus flashStatus;

    Swift

    var flashStatus: GSKCameraSessionFlashStatus { get set }
  • Manually take a photo

    If autoTriggerEnabled is YES, the photo is taken automatically when the frame is detected. Otherwise, if you want to let the user manually trigger the photo, you can use this method.

    This method can be called even when activeDetectionMode is higlightAndTrigger and will force taking the photo.

    IMPORTANT: Taking the photo will pause the session. You have to resume the session will resumeSession once you are done processing the result.

    Declaration

    Objective-C

    - (void)takePhoto;

    Swift

    func takePhoto()
  • True for the duration of taking the photo and processing it. Observable.

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isTakingPhoto) BOOL takingPhoto;

    Swift

    var isTakingPhoto: Bool { get }
  • Returns the current status of the document detection.

    While you can configure the desired mode when setting up the session, the current value can change: for instance, the document detection is disabled while taking the photo.

    Observable.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readonly)
        GSKCameraSessionDocumentDetection activeDocumentDetection;

    Swift

    var activeDocumentDetection: GSKCameraSessionDocumentDetection { get }
  • Camera won’t be used anymore in this session. Makes sure everything can be deallocated successfully.

    Declaration

    Objective-C

    - (void)cleanup;

    Swift

    func cleanup()
  • The camera session delegate.

    This must be the cameraViewController.

    See

    GSKCameraSessionDelegate

    Declaration

    Objective-C

    @property (nonatomic, weak, readwrite, nullable) id<GSKCameraSessionDelegate>
        delegate;

    Swift

    weak var delegate: GSKCameraSessionDelegate? { get set }