| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
SwiftGradients gives you useful extensions for UIViews and CALayer classes to add beautiful color gradients.
pod 'SwiftGradients', '~> 1.0.0'Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. Add the following line to your Cartfile and follow the installation instructions.
github "rootstrap/SwiftGradients" ~> 1.0.0
That should be it. SwiftGradients should appear in the navigation panel as a dependency and the framework will be linked automatically to your target.
Note: It is always recommended to lock your external libraries to a specific version.
let gradientLayer = view.addGradient(
colors: [.blue, .green],
direction: .topToBottom
)You can set a custom angle(measured in degrees and anti-clockwise), rather that one of the four predefined directions. Also, you can provide the color stop locations for better accuracy.
let gradientLayer = view.addGradient(
colors: [.blue, .green, .black],
angle: 45
locations: [0, 50, 75]
)To run the example project, clone the repo, and run pod install from the Example directory first.
SwiftGradients is available under the MIT license. See the LICENSE file for more info.
| Back | FazBrowse Home | New Git URL |