GradientInfo

public struct GradientInfo

A struct storing all of the information needed to describe gradient fills.

  • The Colors for each stop of the gradient. Most gradient drawing in iOS will want these converted to CGColors.

    Declaration

    Swift

    public var colors: [UIColor]
  • The location for each stop of the gradient as a normalized number. The length of this array matches the length of colors

    Declaration

    Swift

    public var locations: [NSNumber]
  • The start point of the gradient. Defines where a ‘0’ location is. Either the start of a line for a linear gradient, or the center of a circle for a radial gradient.

    Declaration

    Swift

    public var startPoint: CGPoint
  • The end point of the gradient. Defines where a ‘1’ location is.

    Declaration

    Swift

    public var endPoint: CGPoint
  • The type of the gradient – either linear or radial.

    Declaration

    Swift

    public var type: CAGradientLayerType
  • A convenience function to draw the gradient into a UIColor as a pattern image

    Declaration

    Swift

    public func color(in size: CGSize) -> UIColor