The ShapeView class is a simple subclass of iOS native UIView that has a CAShapeLayer as its default backing layer. All views that contain shapes are exported from Flow as ShapeView objects.


open class ShapeView: UIView


This class adds 4 variables to UIView that are critical for a standardized way of working with animatable visual content. In particular, this class is designated for working with shapes. As a subclass of UIView it guarantees that animatable views from Flow are compatible with all iOS projects.




Returns the main layer of the view as a CAShapeLayer.

open var shapeLayer: CAShapeLayer {
    return layer as! CAShapeLayer


A sublayer which can be used to apply a gradient fill to the current ShapeView.

By default, CAShapeLayer objects cannot have gradients as fills. This layer makes it possible to have shapes be filled with gradients. When creating a gradient-filled shape, this variable is populated and then masked by the view’s shapeLayer.

open var gradientLayer: CAGradientLayer? {
    set {
        // Remove old gradient layer
        if let gradientLayer = gradientLayer {
        // Replace old gradient with new one
        if let newGradientLayer = newValue {

    get {
        return layer.sublayers?.first(where: { $0 is CAGradientLayer }) as? CAGradientLayer


A convenience variable for accessing and setting the path of the shapeLayer.

open var path: CGPath? {
    get {
        return shapeLayer.path
    set {
        shapeLayer.path = newValue


An override that returns a CAShapeLayer as the default layer type for this view’s class.

override open class var layerClass: AnyClass {
    return CAShapeLayer.self
background Made with Flow.
underscore Made with Flow.
line2 Made with Flow.
line1 Made with Flow.
circle Made with Flow.
hit Made with Flow.

result(s) found for “”.