Protocols

The following protocols are available globally.

  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitProtocol <NSObject>
    
    /// Contains lenses related objects.
    @property (strong, nonatomic, readonly) id<SCCameraKitLensesComponent> lenses;
    
    /// Contains adjustment related objects.
    @property (strong, nonatomic, readonly) id<SCCameraKitAdjustmentsComponent> adjustments;
    
    /// Begin processing input frames with front camera position and portrait video orientation
    /// @param input the input to configure.
    /// @param arInput the ARKit input to configure.
    - (void)startWithInput:(id<SCCameraKitInput>)input
                   arInput:(id<SCCameraKitARInput>)arInput NS_SWIFT_NAME(start(input:arInput:));
    
    /// Deprecated. Use
    /// -startWithInput:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:agreementsPresentationContextProvider:
    - (void)startWithInput:(id<SCCameraKitInput>)input
                   arInput:(id<SCCameraKitARInput>)arInput
            cameraPosition:(AVCaptureDevicePosition)cameraPosition
          videoOrientation:(AVCaptureVideoOrientation)videoOrientation
              dataProvider:(SCCameraKitDataProviderComponent *)dataProvider
              hintDelegate:(id<SCCameraKitLensHintDelegate>)hintDelegate __attribute__((deprecated));
    
    /// Deprecated. Use
    /// -startWithInput:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:textInputContextProvider:agreementsPresentationContextProvider:
    - (void)startWithInput:(id<SCCameraKitInput>)input
                                      arInput:(id<SCCameraKitARInput>)arInput
                               cameraPosition:(AVCaptureDevicePosition)cameraPosition
                             videoOrientation:(AVCaptureVideoOrientation)videoOrientation
                                 dataProvider:(nullable SCCameraKitDataProviderComponent *)dataProvider
                                 hintDelegate:(nullable id<SCCameraKitLensHintDelegate>)hintDelegate
        agreementsPresentationContextProvider:
            (nullable id<SCCameraKitAgreementsPresentationContextProvider>)agreementsPresentationContextProvider
        NS_SWIFT_NAME(start(input:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:agreementsPresentationContextProvider:))
            __attribute__((deprecated));
    ;
    
    /// Begin processing input frames.
    /// @param input the input to configure.
    /// @param arInput the ARKit input to configure.
    /// @param cameraPosition the camera position in use
    /// @param videoOrientation the orientation for the outputted video buffers
    /// @param dataProvider data provider component to pass in custom data providers (optional -- will create and handle
    /// data providers by default if nil)
    /// @param hintDelegate lens hint delegate to show/hide hints for applied lenses
    /// @param textInputContextProvider context provider for providing keyboard access to lenses
    /// @param agreementsPresentationContextProvider context provider for presenting agreements screens
    - (void)startWithInput:(id<SCCameraKitInput>)input
                                      arInput:(id<SCCameraKitARInput>)arInput
                               cameraPosition:(AVCaptureDevicePosition)cameraPosition
                             videoOrientation:(AVCaptureVideoOrientation)videoOrientation
                                 dataProvider:(nullable SCCameraKitDataProviderComponent *)dataProvider
                                 hintDelegate:(nullable id<SCCameraKitLensHintDelegate>)hintDelegate
                     textInputContextProvider:(nullable id<SCCameraKitTextInputContextProvider>)textInputContextProvider
        agreementsPresentationContextProvider:
            (nullable id<SCCameraKitAgreementsPresentationContextProvider>)agreementsPresentationContextProvider
        NS_SWIFT_NAME(start(input:arInput:cameraPosition:videoOrientation:dataProvider:hintDelegate:textInputContextProvider:agreementsPresentationContextProvider:));
    
    /// End processing input frames.
    - (void)stop;
    
    /// End processing input frames.
    /// @param completion Block to be called after processing is finished and session is stopped
    - (void)stopWithCompletion:(nullable void (^)(void))completion NS_SWIFT_NAME(stop(completion:));
    
    /// Add an output. Frames will still be processed if no outputs exist.
    - (void)addOutput:(id<SCCameraKitOutput>)output NS_SWIFT_NAME(add(output:));
    
    /// Remove an output.
    - (void)removeOutput:(id<SCCameraKitOutput>)listener NS_SWIFT_NAME(remove(output:));
    
    /// The camera position in use. Setting will automatically update the input.
    @property (nonatomic, assign) AVCaptureDevicePosition cameraPosition;
    
    /// The orientation for the outputted video buffers
    @property (nonatomic, assign) AVCaptureVideoOrientation videoOrientation;
    
    /// The active input. May be either standard camera input or the AR input, depending on lens requirements.
    @property (nonatomic, readonly) id<SCCameraKitInput> activeInput;
    
    /// Store containing information above the acceptance state of terms of service
    @property (nonatomic, readonly) id<SCCameraKitAgreementsStore> agreementsStore;
    
    /// Presents any agreements such as Terms of Service or Privacy Policy for CameraKit immediately, if needed.
    /// @note CameraKit will present this when the user applies a lens if they have new agreements to accept. You can call
    /// this explicitly if you wish to present the terms before then (eg during an onboarding experience, alongside your own
    /// app's Terms of Service)
    - (void)presentAgreementsImmediately;
    
    @end

    Swift

    protocol CameraKitProtocol : NSObjectProtocol
  • Propogates ARKit session delegate methods back to CameraKit. If you implement your own AR Input, you MUST call these methods when their corresponding ARKit delegate methods are called.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitARInputDelegate
  • Describes a source of AR data for CameraKit.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitARInput <SCCameraKitInput>
  • Describes an interface that will handle fetching the access token.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitAccessTokenProviderTask <NSObject>

    Swift

    protocol AccessTokenProviderTask : NSObjectProtocol
  • Describes an interface to provide an access token (ie. from LoginKit) required by some features like connected lenses, push to device, etc.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitAccessTokenProvider <NSObject>

    Swift

    protocol AccessTokenProvider : NSObjectProtocol
  • Protocol describing the Objective-C interface to an Adjustment.

    Declaration

    Objective-C

    @protocol SCCameraKitAdjustment <NSObject>
  • Protocol describing the Objective-C interface to an Adjustment Controller.

    Declaration

    Objective-C

    @protocol SCCameraKitAdjustmentController <NSObject>

    Swift

    protocol AdjustmentController : NSObjectProtocol
  • A controller to control the tone map adjustment.

    See more

    Declaration

    Objective-C

    @protocol
        SCCameraKitToneMapAdjustmentController <SCCameraKitAdjustmentController>

    Swift

    protocol ToneMapAdjustmentController : AdjustmentController
  • A controller to control the portrait adjustment.

    See more

    Declaration

    Objective-C

    @protocol
        SCCameraKitPortraitAdjustmentController <SCCameraKitAdjustmentController>

    Swift

    protocol PortraitAdjustmentController : AdjustmentController
  • The adjustments processor handles adjusting camera frames before they are processed by lenses.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitAdjustmentsProcessor <NSObject>
  • The adjustments component wraps several adjustment-related classes.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitAdjustmentsComponent <NSObject>

    Swift

    protocol AdjustmentsComponent : NSObjectProtocol
  • Allows conformers to be notified of changes to adjustments processor state

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitAdjustmentsProcessorObserver <NSObject>

    Swift

    protocol AdjustmentsProcessorObserver : NSObjectProtocol
  • Protocol to interface with agreements by CameraKit This interface should not be used directly.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitAgreementSet <NSObject>

    Swift

    protocol AgreementSet : NSObjectProtocol
  • Describes an interface to provide presentation context for CameraKit to present agreements.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitAgreementsPresentationContextProvider <NSObject>

    Swift

    protocol AgreementsPresentationContextProvider : NSObjectProtocol
  • Protocol describing the CameraKit agreements store.

    Warning

    DO NOT attempt to directly use this protocol. Attempting to do so WILL CAUSE YOUR APP TO CRASH. Use SCCameraKitAgreementsPresentationContextProvider to define how CameraKit will show agreements on your behalf.
    See more

    Declaration

    Objective-C

    @protocol SCCameraKitAgreementsStore <NSObject>

    Swift

    protocol AgreementsStore : NSObjectProtocol
  • Params for device motion interface

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitDeviceMotionParameters <NSObject>

    Swift

    protocol DeviceMotionParameters : NSObjectProtocol
  • Protocol to provide device motion data and handle starting/updating/stopping

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitDeviceMotionDataProvider <NSObject>

    Swift

    protocol DeviceMotionDataProvider : NSObjectProtocol
  • Describes an interface to handler errors and exceptions related to CameraKit

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitErrorHandler

    Swift

    protocol ErrorHandler
  • The input destination is an intermediary for frame data.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitInputDestination

    Swift

    protocol InputDestination
  • Describes a source of frames for CameraKit. Can be a camera, file, etc.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitInput

    Swift

    protocol Input
  • Describes an interface that contains lens preview data

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensPreview <NSObject>

    Swift

    protocol LensPreview : NSObjectProtocol
  • Describes a lens object.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLens <NSObject>

    Swift

    protocol Lens : NSObjectProtocol
  • Lens hint delegate used to notify receivers when to show/hide hints for applied lenses

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensHintDelegate <NSObject>

    Swift

    protocol LensHintDelegate : NSObjectProtocol
  • Describes an interface used to provide lens hint localizations from hint ids

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensHintProvider <NSObject>

    Swift

    protocol LensHintProvider : NSObjectProtocol
  • An opaque protocol used to pass launch data to processor when applying lens

    Declaration

    Objective-C

    @protocol SCCameraKitLensLaunchData <NSObject>

    Swift

    protocol LensLaunchData : NSObjectProtocol
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensMediaPickerProvider <NSObject>
    
    /// A delegate that must be notified when loadAndApplyOriginalMediaFromAsset: finishes loading an original asset.
    /// @warning: DO NOT set this delegate manually. CameraKit will set this property appropriately.
    @property (weak, nonatomic) id<SCCameraKitLensMediaPickerProviderMediaApplicationDelegate> mediaApplicationDelegate;
    
    /// A delegate that will be notified when picker-related UI should be shown or hidden.
    @property (weak, nonatomic) id<SCCameraKitLensMediaPickerProviderUIDelegate> uiDelegate;
    
    /// The number of assets that have been fetched and may be displayed by the picker UI.
    @property (readonly, nonatomic, assign) NSInteger fetchedAssetCount;
    
    /// Whether or not the data provider has more assets available to fetch.
    @property (readonly, nonatomic, assign) BOOL hasMoreAssetsToFetch;
    
    /// Fetches a new batch of assets.
    /// @param batchSize How many items to fetch. A provider may return less than this if it exhausts available assets
    /// without reaching the desired batch size
    /// @param queue a dispatch queue to receive callbacks on
    /// @param completion a completion block to be called when the fetch has completed
    - (void)fetchNextAssetBatchOfSize:(NSInteger)batchSize
                                queue:(dispatch_queue_t)queue
                           completion:(void (^)(NSArray<id<SCCameraKitLensMediaPickerAsset>> *))completion
        NS_SWIFT_NAME(fetchNextAssetBatch(size:queue:completion:));
    
    /// Retrieves a fetched asset at a given index.
    /// @param index the index to fetch.
    - (id<SCCameraKitLensMediaPickerAsset>)fetchedAssetAtIndex:(NSInteger)index NS_SWIFT_NAME(fetchedAsset(at:));
    
    /// Loads the full resolution backing asset of a specified asset and applies it to lenses.
    /// @param asset the asset to load and apply
    /// @param completion a completion block called when application is complete
    /// @note Implementors of this method MUST call the appropriate method on the uiDelegate when the loading is completed
    /// in order for the lens to succesfully apply the media.
    - (void)loadAndApplyOriginalMediaFromAsset:(id<SCCameraKitLensMediaPickerAsset>)asset
                                    completion:(nullable void (^)(void))completion
        NS_SWIFT_NAME(loadAndApplyOriginalMedia(from:completion:));
    
    /// Invalidates and resets internal state of the provider with a newly specified allowed media type option set.
    /// @param assetType The asset types to allow in results.
    - (void)reconfigureWithAllowedTypes:(SCCameraKitLensMediaPickerProviderAllowedMediaType)assetType;
    
    @end

    Swift

    protocol LensMediaPickerProvider : NSObjectProtocol
  • An asset provided by the picker. May be backed by a PHAsset, or an app’s own custom media type.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensMediaPickerAsset <NSObject>

    Swift

    protocol LensMediaPickerProviderAsset : NSObjectProtocol
  • Delegate responsible for handling UI events related to the provider, such as showing/hiding a picker.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensMediaPickerProviderUIDelegate <NSObject>

    Swift

    protocol LensMediaPickerProviderUIDelegate : NSObjectProtocol
  • Delegate responsible for applying media to a lens. This should not be implemented directly.

    Note

    If you create a custom provider, you’ll need to call the methods here from your provider. See notes on provider.uiDelegate for more details.
    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensMediaPickerProviderMediaApplicationDelegate <NSObject>

    Swift

    protocol LensMediaPickerProviderMediaApplicationDelegate : NSObjectProtocol
  • Describes an interface used to observe changes in lens fetch status

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensPrefetcherObserver <NSObject>

    Swift

    protocol LensPrefetcherObserver : NSObjectProtocol
  • Describes the interface used to cancel an ongoing prefetch task

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensPrefetcherTask <NSObject>

    Swift

    protocol LensPrefetcherTask : NSObjectProtocol
  • Describes the interface used to prefetch lens content

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensPrefetcher <NSObject>

    Swift

    protocol LensPrefetcher : NSObjectProtocol
  • The lens processor handles transforming camera frames and adding effects to them.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensProcessor <NSObject>

    Swift

    protocol LensProcessor : NSObjectProtocol
  • Allows conformers to be notified of changes to lens processor state

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensProcessorObserver <NSObject>

    Swift

    protocol ProcessorObserver : NSObjectProtocol
  • Describes the remote api service request sent by a lens.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensRemoteApiRequest <NSObject>

    Swift

    protocol LensRemoteApiRequest : NSObjectProtocol
  • Describes the remote api service response to a request sent by a lens.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensRemoteApiResponse <NSObject>

    Swift

    protocol LensRemoteApiResponseProtocol : NSObjectProtocol
  • Describes the call that is sent in response to a remote api request sent by a lens.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensRemoteApiServiceCall <NSObject>

    Swift

    protocol LensRemoteApiServiceCall : NSObjectProtocol
  • Describes a remote api service used to process requests sent by a lens.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensRemoteApiService <NSObject>

    Swift

    protocol LensRemoteApiService : NSObjectProtocol
  • Describes an interface to provide remote api services for specific lenses and api spec identifiers.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensRemoteApiServiceProvider <NSObject>

    Swift

    protocol LensRemoteApiServiceProvider : NSObjectProtocol
  • Allows conformers to be notified of changes to lens groups the repository has available.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensRepositoryGroupObserver <NSObject>

    Swift

    protocol LensRepositoryGroupObserver : NSObjectProtocol
  • Allows conformers to be notified of changes to specific lenses in groups the repository has available.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensRepositorySpecificObserver <NSObject>

    Swift

    protocol LensRepositorySpecificObserver : NSObjectProtocol
  • The lenses component wraps several lens-related classes.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensesComponent <NSObject>

    Swift

    protocol LensesComponent : NSObjectProtocol
  • Lens Repository for listing lenses, getting lenses, etc.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLensRepository <NSObject>

    Swift

    protocol LensRepository : NSObjectProtocol
  • Params for device motion interface

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLocationParameters <NSObject>

    Swift

    protocol LocationParameters : NSObjectProtocol
  • Protocol to provide device motion data and handle starting/updating/stopping

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitLocationDataProvider <NSObject>

    Swift

    protocol LocationDataProvider : NSObjectProtocol
  • Allows conformers to be notified of new frame data from CameraKit.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitOutput <NSObject>

    Swift

    protocol Output : NSObjectProtocol
  • Protocol to interface with preferences stored by CameraKit This interface is intentionally opaque and should only be used to clear out stored preferences

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitPreferences <NSObject>

    Swift

    protocol SCCameraKitPreferences : NSObjectProtocol
  • Protocol for representing a text input view on-screen for lenses that request it.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitTextInputKeyboardAccessoryProvider <NSObject>

    Swift

    protocol TextInputKeyboardAccessoryProvider : NSObjectProtocol
  • Protocol to provide keyboard input data to lenses.

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitTextInputContextProvider <NSObject>

    Swift

    protocol TextInputContextProvider : NSObjectProtocol
  • An opaque protocol describing CameraKit output.

    Declaration

    Objective-C

    @protocol SCCameraKitTexture <NSObject>

    Swift

    protocol Texture : NSObjectProtocol
  • User data provider delegate to provide receivers with new user data on updates

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitUserDataProviderDelegate <NSObject>

    Swift

    protocol UserDataProviderDelegate : NSObjectProtocol
  • Describes an interface that provides user data to lenses

    See more

    Declaration

    Objective-C

    @protocol SCCameraKitUserDataProvider <NSObject>

    Swift

    protocol UserDataProvider : NSObjectProtocol
  • Swift protocol for an adjustment. Specifies an associated Controller type.

    See more