Easily use gradients in UIKit.
Swift Ruby Objective-C
Latest commit 1708c68 Jul 23, 2016 @soffes Version 2.1.1
Failed to load latest commit information.
Example Update example Jul 22, 2016
Gradient View.xcodeproj Update project settings Apr 15, 2016
GradientView Version 2.1.1 Jul 22, 2016
GradientView.podspec Version 2.1.1 Jul 22, 2016
LICENSE Update license year Jun 9, 2015
Readme.markdown Update readme Jun 9, 2015


Gradient View

Easily use gradients in UIKit. Gradient View is a simple UIView wrapper around CGGradient.

Gradient View is tested on iOS 8. Released under the MIT license.

Version Carthage compatible CocoaPods compatible


// Initialize a gradient view
let gradientView = GradientView(frame: CGRectMake(x: 20, y: 20, width: 280, height: 280))

// Set the gradient colors
gradientView.colors = [UIColor.greenColor(), UIColor.yellowColor()]

// Optionally set some locations
gradientView.locations = [0.8, 1.0]

// Optionally change the direction. The default is vertical.
gradientView.direction = .Horizontal

// Add some borders too if you want
gradientView.topBorderColor = UIColor.redColor()
gradientView.bottomBorderColor = UIColor.blueColor()

// Add it as a subview in all of its awesome

See the source for full documentation.


Screenshot Screenshot

Open up the included Xcode project for an example app.


Simply add the files in the to your project. Gradient View also supports installation with Carthage and CocoaPods.