GSKCameraSession
@interface GSKCameraSession : NSObject
The GSKCameraSession class manages the interactions with the device camera.
-
When a photo is generated, the camera session will generate an object implementing the GSKScanProtocol. By passing in this factory, this lets you use your own concrete implementation of this object.
Declaration
Objective-C
- (nonnull instancetype)initWithScanFactory: (nonnull id<GSKScanFactoryProtocol>)scanFactory;
Swift
init(scanFactory: GSKScanFactoryProtocol)
Parameters
scanFactory
An object generating a scan.
-
Preloads the camera so that it’s ready to stream preview and take photo
Declaration
Objective-C
- (void)setup;
Swift
func setup()
-
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
- (void)setFlashStatus:(GSKCameraSessionFlashStatus)flashStatus onSuccess: (nonnull void (^)(GSKCameraSessionFlashStatus))successBlock error:(nonnull void (^)(NSError *_Nullable))errorBlock;
Swift
func setFlashStatus(_ flashStatus: GSKCameraSessionFlashStatus, onSuccess successBlock: @escaping (GSKCameraSessionFlashStatus) -> Void, error errorBlock: @escaping (Error?) -> Void)
Parameters
flashStatus
The new status for the flash
successBlock
The block called on success
errorBlock
The block called on error
-
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 autoTriggerEnabled and will force taking the photo.
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 }
-
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.
See
GSKCameraSessionDelegateDeclaration
Objective-C
@property (nonatomic, weak, readwrite, nullable) id<GSKCameraSessionDelegate> delegate;
Swift
weak var delegate: GSKCameraSessionDelegate? { get set }