Skip to content

A fully customisable subclass of the UIButton which allows you to create beautiful gradient buttons.

License

Notifications You must be signed in to change notification settings

suhitp/SwiftGradientButton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftGradientButton

A fully customisable subclass of the UIButton which allows you to create beautiful gradient buttons.

Swift Version License Platform

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.

Requirements

  • iOS 11 or any higher version.
  • Xcode 9 or any higher version.
  • Swift 5.0 or any higher version.

Installation

  • SwiftGradientButton is compatible with Swift 5 as of release 0.1.0.

CocoaPods

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

How to use

UIStoryboard / Xib

change UIButton class to GradientButton and customise below properties

Programatically

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)

Author

Suhit Patil, suhit.patil@gmail.com

License

SwiftGradientButton is available under the MIT license.

About

A fully customisable subclass of the UIButton which allows you to create beautiful gradient buttons.

Resources

License

Stars

Watchers

Forks

Packages

No packages published