GradientView
public final class GradientView : UIView
An easy to use wrapper around CGGradient
for drawing linear gradients.
For examples and testing its usage, you can use the FueledUtils
playground file provided with the workspace.
-
Defines the colors of a given type.
See moreDeclaration
Swift
public enum Definition
-
Defines the different type of supported gradients.
See moreDeclaration
Swift
public enum GradientType
-
Get/Set the type of the gradient. Please refer to
GradientType
for more info.Declaration
Swift
public var type: GradientView.GradientType { get set }
-
Get/Set the definition of the gradient. Please refer to
Definition
for more info.Warning
If the definition is.custom
, and the array has less than 2 elements, the code will crash at runtime.Declaration
Swift
public var definition: GradientView.Definition { get set }
-
Get/Set the start color of the gradient. When getting the property, if the gradient is
.custom
, it will return the first color in the array. When setting this property, if the gradient is.custom
, it will convert it to a.simple
using the last color of the array as theendColor
.Declaration
Swift
@IBInspectable public var startColor: UIColor { get set }
-
Get/Set the end color of the gradient. When getting the property, if the gradient is
.custom
, it will return the last color in the array. When setting this property, if the gradient is.custom
, it will convert it to a.simple
using the first color of the array as thestartColor
.Declaration
Swift
@IBInspectable public var endColor: UIColor { get set }
-
Please refer to the documentation for
UIView.init(frame:)
Declaration
Swift
override public init(frame: CGRect)
-
Please refer to the documentation for
UIView.init(coder:)
Declaration
Swift
required public init?(coder aDecoder: NSCoder)
-
Please refer to the documentation for
UIView.draw(_:)
Declaration
Swift
override public func draw(_ rect: CGRect)