UIView
public extension UIView
-
Setup the shadow layer of this UIView.
Declaration
Swift
func setupShadow(colour: UIColor, opacity: Float, offset: CGSize, radius: CGFloat)Parameters
colourA UIColor representing the colour of the shadow.
opacityA Float for the opacity of the shadow.
offsetA CGSize to determine the shadow’s offset from its origin.
radiusA CGFloat of the blur radius of the shadow.
-
Setup a border surrounding this UIView.
Declaration
Swift
func setupBorder(colour: UIColor, width: CGFloat)Parameters
colourA UIColor representing the colour of the border.
widthA 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
colorsAn array of UIColor to be part of the gradient. The number of UIColors must match the number of NSNumbers.
locationsAn 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.
orientationThe orientation of the gradient; horizontal or vertical.
customBoundsAn optional CGRect to specify the bounds of the gradient. By default, it is this UIView’s bounds.
UIView Extension Reference