SBSDKFinderLayer

@interface SBSDKFinderLayer : CAShapeLayer

A layer class to display a view finder with colored background and transparent cutout with the given aspect ratio. To change the color just set the layers backgroundColor property.

  • The receivers delegate.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<SBSDKFinderLayerDelegate> finderDelegate;

    Swift

    weak var finderDelegate: SBSDKFinderLayerDelegate? { get set }
  • The aspect ratio of the viewport (cutout), if set to -1, no cutout is drawn. Defaults to -1.

    Declaration

    Objective-C

    @property (nonatomic) double displayedAspectRatio;

    Swift

    var displayedAspectRatio: Double { get set }
  • Parameter that defines minimum inset of viewport from edge of the screen. Width - horizontal inset, height - vertical. Default for both is 32.

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets minimumInset;

    Swift

    var minimumInset: UIEdgeInsets { get set }
  • The current rect of the finders viewport in local coordinate system.

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGRect finderRect;

    Swift

    var finderRect: CGRect { get }
  • The color of the receivers border line. Can be nil.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *lineColor;

    Swift

    var lineColor: UIColor? { get set }
  • The corner radius receivers border line. Defaults to 8.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat lineCornerRadius;

    Swift

    var lineCornerRadius: CGFloat { get set }
  • Set to YES for animated finder changes, to NO otherwise. Defaults to YES.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isAnimatingChanges) BOOL animateChanges;

    Swift

    var isAnimatingChanges: Bool { get set }
  • A function, that returns a rect of a finder, if it will be placed in view with certain bounds, with given aspect ratio and insets. Useful for pre-calculations in some animation cases.

    Declaration

    Objective-C

    + (CGRect)potentialFinderRectWithBounds:(CGRect)bounds
                                aspectRatio:(double)aspectRatio
                              minimumInsets:(UIEdgeInsets)minimumInsets;

    Swift

    class func potentialFinderRect(withBounds bounds: CGRect, aspectRatio: Double, minimumInsets: UIEdgeInsets) -> CGRect

    Parameters

    bounds

    The bounds of the view, where potential layer will be placed.

    aspectRatio

    An expected aspect ratio.

    minimumInsets

    Minimal insets of finder.

    Return Value

    A calculated rect of potential finder.