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: about 2 hours 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: 2024-11-13T06:33:21.790Z (3 days ago)
- Topics: carthage, cocoapods, ios, swift, tvos
- Language: Swift
- Homepage:
- Size: 355 KB
- Stars: 626
- 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.
[![Version](https://img.shields.io/github/release/soffes/GradientView.svg)](https://github.com/soffes/GradientView/releases)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![CocoaPods compatible](https://img.shields.io/cocoapods/v/GradientView.svg)](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.