Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soffes/gradientview
Easily use gradients in UIKit for iOS & tvOS
https://github.com/soffes/gradientview
carthage cocoapods ios swift tvos
Last synced: 6 days ago
JSON representation
Easily use gradients in UIKit for iOS & tvOS
- Host: GitHub
- URL: https://github.com/soffes/gradientview
- Owner: soffes
- License: mit
- Created: 2013-06-30T21:32:05.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-06-03T16:47:21.000Z (over 4 years ago)
- Last Synced: 2025-02-14T21:35:26.916Z (6 days ago)
- Topics: carthage, cocoapods, ios, swift, tvos
- Language: Swift
- Homepage:
- Size: 355 KB
- Stars: 629
- Watchers: 14
- Forks: 100
- Open Issues: 8
-
Metadata Files:
- Readme: Readme.markdown
- License: LICENSE
Awesome Lists containing this project
README
# Gradient View
Easily use gradients in UIKit. Gradient View is a simple UIView wrapper around CGGradient.
[](https://github.com/soffes/GradientView/releases)
[](https://github.com/Carthage/Carthage)
[](https://cocoapods.org/pods/GradientView)## Usage
``` swift
// Initialize a gradient view
let gradientView = GradientView(frame: CGRect(x: 20, y: 20, width: 280, height: 280))// Set the gradient colors
gradientView.colors = [.green, .yellow]// 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 = .red
gradientView.bottomBorderColor = .blue// Add it as a subview in all of its awesome
view.addSubview(gradientView)
```See the [source](GradientView/GradientView.swift) for full documentation.
## Example
![]()
Open up the included Xcode project for an example app.
## Installation
Gradient View supports installation with [Carthage](https://github.com/Carthage/Carthage) or [CocoaPods](https://cocoapods.org/pods/GradientView). You can also simply add [GradientView.swift](GradientView/GradientView.swift) to your project if you’d prefer.