A Swift 4 UIView class with a gradient rendered and customizable in the storyboard (colors, direction, shadows, cornerRadius...)
A Swift 4 UIView class with a gradient customizable in the storyboard (colors, direction, shadows, cornerRadius…)
GradientView: UIView is a @IBDesignable class so that it’s rendered in your storyboard, and all its properties are @IBInspectable so that you can customize your gradient view inside the storyboard in the Attributes inspector.
animate(duration: TimeInterval, newTopColor: UIColor, newBottomColor: UIColor)
methodThis is only for editing UIViews. Although it will work on other classes (buttons, etc.), the text that comes with those will be behind the gradient color. For this reason, if you wish to add it to other classes (buttons), you will need to composite a label on top of it so that you can still see the text.