# GradientView
**Repository Path**: wenwenpro/GradientView
## Basic Information
- **Project Name**: GradientView
- **Description**: Easily use gradients in UIKit for iOS & tvOS
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-30
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## 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.