UIView
public extension UIView
-
Setup the shadow layer of this UIView.
Declaration
Swift
func setupShadow(colour: UIColor, opacity: Float, offset: CGSize, radius: CGFloat)
Parameters
colour
A UIColor representing the colour of the shadow.
opacity
A Float for the opacity of the shadow.
offset
A CGSize to determine the shadow’s offset from its origin.
radius
A CGFloat of the blur radius of the shadow.
-
Setup a border surrounding this UIView.
Declaration
Swift
func setupBorder(colour: UIColor, width: CGFloat)
Parameters
colour
A UIColor representing the colour of the border.
width
A CGFloat representing the thickness of the border.
-
Constants to represent the CAGradientLayer’s orientation.
- horizontal: Indicates a horizontal CAGradientLayer.
- vertical: Indicates a vertical CAGradientLayer.
Declaration
Swift
enum GradientOrientation
-
Setup a gradient layer or override an existing gradient layer with the given colors, locations, orientation and an optional customBound.
Declaration
Swift
func setupGradient(colors: [UIColor], locations: [NSNumber], orientation: GradientOrientation, customBounds: CGRect? = nil)
Parameters
colors
An array of UIColor to be part of the gradient. The number of UIColors must match the number of NSNumbers.
locations
An array of NSNumber (between 0.0 - 1.0) specifying each point of the UIColors given. The number of NSNumbers must match the number of UIColors.
orientation
The orientation of the gradient; horizontal or vertical.
customBounds
An optional CGRect to specify the bounds of the gradient. By default, it is this UIView’s bounds.