Skip to content

A lightweight gradient view for iOS 7+, written in Swift, with support for Auto Layout and Interface Builder.

License

Notifications You must be signed in to change notification settings

bryx-inc/BRYXGradientView

Repository files navigation

BRYXGradientView

Carthage compatible

A lightweight gradient view for iOS 7+, written in Swift, with support for Auto Layout and Interface Builder.

Usage

Programmatically

Create a gradient view using the designated initializer.

let gradientView = GradientView(topColor: UIColor.cyanColor(), bottomColor: UIColor.blueColor())

Change colors after initialization:

 gradientView.topColor = UIColor.yellowColor()
 gradientView.bottomColor = UIColor.orangeColor()

Change the colors of the CAGradientLayer directly:

gradientView.gradientLayer.colors = [UIColor.redColor().CGColor, UIColor.orangeColor().CGColor, UIColor.yellowColor().CGColor]

Interface Builder

Drag a View object to the Interface Builder canvas, and change the Class in the Identity inspector:

Identity inspector

Then change the colors in the Attributes inspector:

Attributes inspector

Requirements

Demo project requires iOS 8+, though BRYXGradientView works on iOS 7+

Installation

BRYXGradientView is available through CocoaPods and Carthage.

Author

Adam Binsz, adam@adambinsz.com

License

BRYXGradientView is available under the MIT license. See the LICENSE file for more info.

About

A lightweight gradient view for iOS 7+, written in Swift, with support for Auto Layout and Interface Builder.

Resources

License

Stars

Watchers

Forks

Packages

No packages published