Type Definitions

The following type definitions are available globally.

  • The block callback signature when the camera requests authentication.

    Declaration

    Objective-C

    typedef void (^CBLCameraAuthenticationRequestBlock)(
        id<CBLCameraAuthenticationContext> _Nonnull)

    Swift

    typealias CameraAuthenticationRequestBlock = (CameraAuthenticationContext) -> Void

    Parameters

    context

    The authentication context object for inspecting the request and delivering a response.

  • The block callback signature when a camera’s authentication request has been resolved and authentication UI can be hidden.

    Declaration

    Objective-C

    typedef void (^CBLCameraAuthenticationResolvedBlock)(void)

    Swift

    typealias CameraAuthenticationResolvedBlock = () -> Void
  • The block callback signature when camera connection completes or fails.

    Declaration

    Objective-C

    typedef void (^CBLCameraConnectionCompleteBlock)(
        NSError *_Nullable, NSArray<id<CBLCameraConnectionWarning>> *_Nullable)

    Swift

    typealias ConnectionCompleteCallback = (Error?, [ConnectionWarning]?) -> Void

    Parameters

    error

    The error that occurred, if any.

    warnings

    Any non-fatal connection warnings.

  • The block callback signature when a camera has a new camera-initiated transfer request. See CBLCameraInitiatedTransferRequest for details.

    Declaration

    Objective-C

    typedef void (^CBLCameraInitiatedTransferRequestHandler)(
        id<CBLCameraInitiatedTransferRequest> _Nonnull)

    Swift

    typealias CameraInitiatedTransferRequestHandler = (CameraInitiatedTransferRequest) -> Void
  • An observer token. Required to unregister an oberver.

    Declaration

    Objective-C

    typedef NSString CBLCameraObserverToken

Live View

  • The live view frame delivery callback.

    Declaration

    Objective-C

    typedef void (^CBLCameraLiveViewFrameDelivery)(
        id<CBLCameraLiveViewFrame> _Nonnull, dispatch_block_t _Nonnull)

    Swift

    typealias LiveViewFrameDelivery = (LiveViewFrame, @escaping () -> Void) -> Void

    Parameters

    frame

    A live view frame from the camera.

    completionHandler

    A completion handler to inform the camera that you’re ready for the next frame. This MUST be called, and can be called from any thread.

  • The handler for the live view stream ending.

    Declaration

    Objective-C

    typedef void (^CBLCameraLiveViewTerminationHandler)(
        CBLCameraLiveViewTerminationReason, NSError *_Nullable)

    Swift

    typealias LiveViewTerminationHandler = (LiveViewTerminationReason, Error?) -> Void

    Parameters

    reason

    The reason the live view stream ended.

    error

    The error that caused the failure, if reason is CBLCameraLiveViewTerminationReasonFailed.

  • The block callback signature when the discovery object changes the list of available cameras.

    Declaration

    Objective-C

    typedef void (^CBLCameraDiscoveryAvailableDevicesChangedCallback)(
        NSArray<id<CBLCamera>> *_Nonnull)

    Swift

    typealias CameraDiscoveryAvailableDevicesChangedCallback = ([CBLCamera]) -> Void
  • The block callback signature when a service has completed or failed resolving.

    Declaration

    Objective-C

    typedef void (^CBLCameraDiscoveryServiceResolveCallback)(
        id<CBLCameraDiscoveryService> _Nonnull, NSError *_Nullable)

    Swift

    typealias CameraDiscoveryServiceResolveCallback = (CameraDiscoveryService, Error?) -> Void

    Parameters

    service

    The service that completed or failed resolving.

    error

    If the operation failed, an error object describing the operation.

  • The block callback signature when a service has completed or failed resolving metadata.

    Declaration

    Objective-C

    typedef void (^CBLCameraDiscoveryMetadataResolveCallback)(
        id<CBLCameraDiscoveryService> _Nonnull, NSError *_Nullable)

    Swift

    typealias CameraDiscoveryMetadataResolveCallback = (CameraDiscoveryService, Error?) -> Void

    Parameters

    service

    The service that completed or failed resolving.

    error

    If the operation failed, an error object describing the operation.

  • The block callback signature for handling the result of a request to execute a camera-initiated transfer, containing either the result of the transfer, or an error describing the failure.

    Declaration

    Objective-C

    typedef void (^CBLCameraInitiatedTransferCompletionHandler)(
        id<CBLCameraInitiatedTransferResult> _Nullable, NSError *_Nullable)

    Swift

    typealias CameraInitiatedTransferCompletionHandler = (CameraInitiatedTransferResult?, Error?) -> Void
  • The callback block signature that is called when a manual camera lookup succeeds or fails.

    Declaration

    Objective-C

    typedef void (^CBLCameraCreationOperationCallback)(id<CBLCamera> _Nullable,
                                                       NSError *_Nullable)

    Swift

    typealias CameraCreationOperationCallback = (CBLCamera?, Error?) -> Void

    Parameters

    camera

    The camera that was created, if the operation was successful.

    error

    An error, if the operation failed.

  • A property common value. Values will be from one of the appropriate common value enums as defined below.

    Declaration

    Objective-C

    typedef NSInteger CBLPropertyCommonValue

    Swift

    typealias PropertyCommonValue = Int
  • The block callback signature for property observations.

    Declaration

    Objective-C

    typedef void (^CBLCameraPropertyObservationCallback)(
        id<CBLCameraProperty> _Nonnull, CBLPropertyChangeType)

    Swift

    typealias CameraPropertyObservationCallback = (CameraProperty, PropertyChangeType) -> Void

    Parameters

    property

    The property that fired the change.

    type

    The change type(s) that occurred. See CBLPropertyChangeType for details.

  • The block callback signature for an async operation that can fail with an error.

    Declaration

    Objective-C

    typedef void (^CBLErrorableOperationCallback)(NSError *_Nullable)

    Swift

    typealias ErrorableOperationCallback = (Error?) -> Void

    Parameters

    error

    The error that occurred, if any. If nil, the operation succeeded.

  • A value representing a camera family, usually grouped by camera manufacturer.

    Declaration

    Objective-C

    typedef NSInteger CBLCameraFamily

    Swift

    typealias CameraFamily = Int
  • A filesystem observation block.

    Declaration

    Objective-C

    typedef void (^CBLFileStorageFilesModifiedObserver)(
        id<CBLFileStorage> _Nonnull, id<CBLFileSystemFolderItem> _Nullable,
        CBLFileSystemModificationOperation,
        NSArray<id<CBLFileSystemItem>> *_Nullable)

    Swift

    typealias FileStorageFilesModifiedObserver = (FileStorage, FileSystemFolderItem?, FileSystemModificationOperation, [CBLFileSystemItem]?) -> Void

    Parameters

    storage

    The filesystem storage instance that the change occurred on.

    modifiedFolder

    The folder in which the change occurred.

    operation

    The operation that occurred.

    affectedItems

    The items that were added or removed.

  • A filesystem observer token. Required to unregister an oberver.

    Declaration

    Objective-C

    typedef NSString CBLFileStorageObserverToken
  • The callback block preflight signature for fetching image previews. This will be called just before an image preview is about to be fetched.

    This can be useful when implementing (example) a scrolling list of thumbnails — if the user is scrolling quickly, you can cancel requests for thumbnails that are no longer onscreen.

    Declaration

    Objective-C

    typedef BOOL (^CBLPreviewImagePreflight)(id<CBLFileSystemItem> _Nonnull)

    Swift

    typealias PreviewImagePreflight = (FileSystemItem) -> Bool

    Parameters

    item

    The filesystem item the preview will be fetched for.

    Return Value

    Return YES to continue to fetch the preview, otherwise NO to cancel.

  • The callback block signature for a completed or failed image previews.

    Declaration

    Objective-C

    typedef void (^CBLPreviewImageDelivery)(id<CBLFileSystemItem> _Nonnull,
                                            NSError *_Nullable, NSData *_Nullable)

    Swift

    typealias PreviewImageDelivery = (FileSystemItem, Error?, Data?) -> Void

    Parameters

    item

    The filesystem item the preview is for.

    error

    If the operation failed, an error object that describes the failure.

    imageData

    If the operation succeeded, JPEG data for the preview.

  • The callback block preflight signature for fetching image EXIF metadata. This will be called just before the metadata is about to be fetched.

    This can be useful when implementing (example) a scrolling list of iamges — if the user is scrolling quickly, you can cancel metadata requests for images that are no longer onscreen.

    Declaration

    Objective-C

    typedef BOOL (^CBLEXIFPreflight)(id<CBLFileSystemItem> _Nonnull)

    Swift

    typealias EXIFPreflight = (FileSystemItem) -> Bool

    Parameters

    item

    The filesystem item the metadata will be fetched for.

    Return Value

    Return YES to continue to fetch the metadata, otherwise NO to cancel.

  • The callback block signature for a completed or failed image metadata requests.

    Declaration

    Objective-C

    typedef void (^CBLEXIFDelivery)(id<CBLFileSystemItem> _Nonnull,
                                    NSError *_Nullable,
                                    NSDictionary<NSString *, id> *_Nullable)

    Swift

    typealias EXIFDelivery = (FileSystemItem, Error?, [String : Any]?) -> Void

    Parameters

    item

    The filesystem item the metadata is for.

    error

    If the operation failed, an error object that describes the failure.

    imageMetadata

    If the operation succeeded, ImageIO-compatible metadata.

  • The callback block preflight signature for streaming files from the camera. This will be called just before the stream is about to begin.

    Declaration

    Objective-C

    typedef id _Nullable (^CBLFileStreamPreflight)(id<CBLFileSystemItem> _Nonnull)

    Swift

    typealias FileStreamPreflight = (FileSystemItem) -> Any?

    Parameters

    item

    The filesystem item that will be streamed.

    Return Value

    Return any object to use as a “context” for the operation, including nil. This object will be passed to chunk delivery callbacks. For example, you may want to set up a file handle or data storage object here for chunks to be written to later.

  • The callback block signature for data chunk delivery when streaming files from the camera. This will be called multiple times in sequence once an operation starts.

    IMPORTANT: In some circumstances, this delivery block may be invoked with an empty/zero-length chunk of data. Make sure your code handles this case properly. Such a delivery should not be treated as an error, and you should return the desired instruction.

    Declaration

    Objective-C

    typedef CBLFileStreamInstruction (^CBLFileStreamChunkDelivery)(
        id<CBLFileSystemItem> _Nonnull, NSData *_Nonnull, id _Nullable)

    Swift

    typealias FileStreamChunkDelivery = (FileSystemItem, Data, Any?) -> FileStreamInstruction

    Parameters

    item

    The filesystem item being streamed.

    chunk

    The chunk of file data delivered from the camera.

    context

    The context object returned from the streaming preflight block.

    Return Value

    Return CBLFileStreamInstructionContinue to continue the operation and get more chunks, or CBLFileStreamInstructionCancel to cancel the operation.

  • The callback block signature that will be called when a file streaming operation completes for fails.

    Declaration

    Objective-C

    typedef void (^CBLFileStreamCompletion)(id<CBLFileSystemItem> _Nonnull,
                                            NSError *_Nullable, id _Nullable)

    Swift

    typealias FileStreamCompletion = (FileSystemItem, Error?, Any?) -> Void

    Parameters

    item

    The filesystem item being streamed.

    error

    If the operation failed (including being cancelled), an error describing the failure.

    context

    The context object returned from the streaming preflight block.