SCCameraKitPreviewView
Objective-C
@interface SCCameraKitPreviewView <SCCameraKitOutput,
SCCameraKitOutputViewportProviding,
SCCameraKitOutputViewportProvidingDelegate>
Swift
class PreviewView : Output, OutputViewportProviding, OutputViewportProvidingDelegate
A UIView which is capable of rendering SCCameraKitTextures. You should add this as an output for your CameraKit instance.
-
Configures the neccessary gesture recognizers for handling touch input in lenses. If set to YES, will automatically add gesture reconizers and configure them to pass events to lenses.
Note
by default, this is NO. You may change this to YES while cameraKit is running, and it will be configured on the next frame.Declaration
Objective-C
@property (nonatomic) BOOL automaticallyConfiguresTouchHandler;
Swift
var automaticallyConfiguresTouchHandler: Bool { get set }
-
Configures the viewport upon changes to the view’s frame. If set to YES, this will automatically adjust
viewportSize
,outputResolution
, andsafeArea
according to the view’s frame.Note
By default, this is YES. If the viewport is explicitly defined via explicitViewportProvider, this will be set to NO.Note
If you change this property without setting explicitViewportProvider, the view will keep the last derivedviewportSize
,outputResolution
, andsafeArea
.Warning
If there is a mismatch betweenviewportSize
and the view’s frame size, part of the lens may be cut off on the screen.Declaration
Objective-C
@property (nonatomic) BOOL automaticallyConfiguresViewport;
Swift
var automaticallyConfiguresViewport: Bool { get set }
-
Configures the content mode the preview view will use to render.
Note
SCCameraKitPreviewViewContentModeAspectFill by default.Declaration
Objective-C
@property (nonatomic) SCCameraKitPreviewViewContentMode contentMode;
Swift
var contentMode: SCCameraKitPreviewViewContentMode { get set }
-
Configures the safe area to an explicitly specified rect.
Declaration
Objective-C
@property (nonatomic) CGRect safeArea;
Swift
var safeArea: CGRect { get set }
-
Setting this property configures the preview view to use its
viewportSize
,outputResolution
, andsafeArea
.Note
Calling this method will setautomaticallyConfiguresViewport
to NO.Warning
If there is a mismatch betweenviewportSize
and the view’s frame size, part of the lens may be cut off the screen.Declaration
Objective-C
@property (nonatomic, strong, nullable) SCCameraKitExplicitViewportProvider *explicitViewportProvider;
Swift
var explicitViewportProvider: ExplicitViewportProvider? { get set }
-
Automatically configures the safeArea property to avoid the specified views.
Note
the preview view maintain a weak reference to the provided views and update the safe area automatically as needed.Warning
this method will reevaluate periodically (during bounds changes, etc), but will NOT actively track changes to occluding views between those intervals. If you move an occluding view without affecting the preview view, call this method again to reevaluate.Declaration
Objective-C
- (void)configureSafeAreaWithOccludingViews:(nonnull NSArray *)occludingViews;
Swift
func configureSafeArea(with occludingViews: [Any])
Parameters
occludingViews
any views that may be displayed in front of lenses content, such as the carousel, camera flip button, etc. If the preview view itself is part of this array, it will be ignored.
-
Clears the underlying texture and notifies completion once done.
Declaration
Objective-C
- (void)clearWithCompletion:(nullable void (^)(BOOL))completion;
Swift
func clear() async -> Bool