UIImage

extension UIImage
  • Create a simple gradient image from inStartColor on left and inEndColor on right (if horizontal), or inStartColor on top, and inEndColor on bottom (if vertical)

    Declaration

    Swift

    static func gradientImage(from inStartColor: UIColor, to inEndColor: UIColor, with inFrame: CGRect, isVertical inIsVertical: Bool = false) -> UIImage

    Parameters

    inStartColor

    left side or top

    inEndColor

    right side or bottom

    inFrame

    frame to be filled (Cannot be empty)

    inIsVertical

    True, if the gradient is top to bottom (default is false)

    Return Value

    a gradient image, or a “nosign” image.