Gradient

public class Gradient: View

The Gradient class draws a color gradient over its background color, filling the shape of the view (including rounded corners).

  • The background layer of the receiver.

    Declaration

    Swift

    public var gradientLayer: GradientLayer
  • An array of Color objects defining the color of each gradient stop. Animatable.

    Declaration

    Swift

    public var colors: [Color]
  • An optional array of Double values defining the location of each gradient stop. Animatable.

    Defaults to [0,1]

    Declaration

    Swift

    public var locations: [Double]
  • The start point of the gradient when drawn in the layer’s coordinate space. Animatable.

    Defaults to the top-left corner of the frame {0.0,0.0}

    Declaration

    Swift

    public var startPoint: Point
  • The end point of the gradient when drawn in the layer’s coordinate space. Animatable.

    Defaults to the top-right corner of the frame {1.0,0.0}

    Declaration

    Swift

    public var endPoint: Point
  • The current rotation value of the view. Animatable. - returns: A Double value representing the cumulative rotation of the view, measured in Radians.

    Declaration

    Swift

    public override var rotation: Double

    Return Value

    A Double value representing the cumulative rotation of the view, measured in Radians.

  • Initializes a new Gradient.

    Declaration

    Swift

    public convenience override init(frame: Rect)

    Parameters

    frame

    A Rect that defines the frame for the gradient’s view.

    colors

    An array of Color objects that define the gradient’s colors. Defaults to [C4Blue, C4Purple].

    locations

    An array of Double values that define the location of each gradient stop. Defaults to [0,1]

  • Undocumented

    Declaration

    Swift

    public class Gradient: View