Skip to content

Latest commit

 

History

History
42 lines (37 loc) · 1.57 KB

File metadata and controls

42 lines (37 loc) · 1.57 KB

HVGradientView

HVGradientView is a pod which helps to add gradient effect to any UIVIew. It is written in Swift 4.

Installation

Using Cocoapods

  1. Open podfile in your project.
  2. Add the following into your podfile:
pod ‘HVGradientView’, :git => ‘https://github.com/Harsh061/HVGradientView.git’, :tag => ‘1.0.0’
  1. Run the command:
pod install

Usage

  1. Open the project. Drag a UIView into storyboard.
  2. Go the the identity inspector and in the class field, type HVGradientView instead of UIView.
  3. Open the viewcontroller and create an outlet of the view.
@IBOutlet weak var gradientView: HVGradientView!
  1. Set your custom properties like topColor, bottomColor, CornerRadius and Gradient direction.
  2. Gradient direction can be:
Horizontal

Vertical

Diagonal

Example:

private func setupGradientView() {
   gradView.translatesAutoresizingMaskIntoConstraints = false
   gradView.topColor = UIColor.yellow
   gradView.bottomColor = UIColor.red
   gradView.gradientDirection = .horizontal
}