A fully customisable subclass of the UIButton which allows you to create beautiful gradient buttons.
SwiftGradientButton is a library for to create custom GradientButton for iOS. It can be used to easily apply custom gradients on UIButton with custom startColor, endColor, startPoint, endPoint properties. Use cornerRadius property to apply rounded corners to GradientButton.
- iOS 11 or any higher version.
- Xcode 9 or any higher version.
- Swift 5.0 or any higher version.
- SwiftGradientButton is compatible with Swift 5 as of release 0.1.0.
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate SwiftGradientButton into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/cocoapods/specs.git'
platform :ios, '11.0'
use_frameworks!
pod 'SwiftGradientButton'
Then, run the following command:
$ pod install
change UIButton class to GradientButton and customise below properties
import SwiftGradientButton in your UIViewController or UIView subclass file and create custom GradientButton property like below and apply customisations
let gradientButton = GradientButton()
gradientButton.cornerRadius = 5
gradientButton.startColor = UIColor.blue
gradientButton.endColor = UIColor.green
gradientButton.startPoint = CGPoint(x: 0.0, y: 0.5)
gradientButton.endPoint = CGPoint(x: 1.0, y: 0.5)
Suhit Patil, suhit.patil@gmail.com
SwiftGradientButton is available under the MIT license.