SCCameraKitLensMediaPickerProvider
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
Undocumented
-
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.
Declaration
Objective-C
@property (nonatomic, weak) id< SCCameraKitLensMediaPickerProviderMediaApplicationDelegate> _Nullable mediaApplicationDelegate;
Swift
weak var mediaApplicationDelegate: LensMediaPickerProviderMediaApplicationDelegate? { get set }
-
A delegate that will be notified when picker-related UI should be shown or hidden.
Declaration
Objective-C
@property (nonatomic, weak) id<SCCameraKitLensMediaPickerProviderUIDelegate> _Nullable uiDelegate;
Swift
weak var uiDelegate: LensMediaPickerProviderUIDelegate? { get set }
-
The number of assets that have been fetched and may be displayed by the picker UI.
Declaration
Objective-C
@property (nonatomic, readonly) NSInteger fetchedAssetCount;
Swift
var fetchedAssetCount: Int { get }
-
Whether or not the data provider has more assets available to fetch.
Declaration
Objective-C
@property (nonatomic, readonly) BOOL hasMoreAssetsToFetch;
Swift
var hasMoreAssetsToFetch: Bool { get }
-
Fetches a new batch of assets.
Declaration
Objective-C
- (void)fetchNextAssetBatchOfSize:(NSInteger)batchSize queue:(nonnull dispatch_queue_t)queue completion: (nonnull void (^)( NSArray<id<SCCameraKitLensMediaPickerAsset>> *_Nonnull))completion;
Swift
func fetchNextAssetBatch(size batchSize: Int, queue: DispatchQueue) async -> [LensMediaPickerProviderAsset]
Parameters
batchSize
How many items to fetch. A provider may return less than this if it exhausts available assets without reaching the desired batch size
queue
a dispatch queue to receive callbacks on
completion
a completion block to be called when the fetch has completed
-
Retrieves a fetched asset at a given index.
Declaration
Objective-C
- (nonnull id<SCCameraKitLensMediaPickerAsset>)fetchedAssetAtIndex: (NSInteger)index;
Swift
func fetchedAsset(at index: Int) -> LensMediaPickerProviderAsset
Parameters
index
the index to fetch.
-
Loads the full resolution backing asset of a specified asset and applies it to lenses.
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.Declaration
Objective-C
- (void)loadAndApplyOriginalMediaFromAsset: (nonnull id<SCCameraKitLensMediaPickerAsset>)asset completion:(nullable void (^)(void))completion;
Swift
func loadAndApplyOriginalMedia(from asset: LensMediaPickerProviderAsset) async
Parameters
asset
the asset to load and apply
completion
a completion block called when application is complete
-
Invalidates and resets internal state of the provider with a newly specified allowed media type option set.
Declaration
Objective-C
- (void)reconfigureWithAllowedTypes: (SCCameraKitLensMediaPickerProviderAllowedMediaType)assetType;
Swift
func reconfigure(withAllowedTypes assetType: SCCameraKitLensMediaPickerProviderAllowedMediaType)
Parameters
assetType
The asset types to allow in results.