Latest 1.0.2
Homepage https://github.com/roydenrego/GradientButtonSwift
License MIT
Platforms ios 9.0
Authors

A iOS Swift library for Gradient Button.

Swift Version
License
CocoaPods Compatible
Platform
PRs Welcome

GradientButtonSwift is a swift library for applying gradients on UIButton for iOS projects. Gradient can be applied by specifying the top and bottom color for the button and the gradient will be automatically applied. It also supports specifying corner radius if you want a nice gradient button with rounded corners.

GradientButtonSwift

Requirements

  • iOS 9.0+
  • Xcode 8.0+

Installation

CocoaPods

You can use CocoaPods to install GradientButtonSwift by adding it to your Podfile:

platform :ios, '9.0'
use_frameworks!
pod 'GradientButtonSwift'

To get the full benefits import GradientButtonSwift wherever you import UIKit

import UIKit
import GradientButtonSwift

Manually

  1. Download and drop GradientButton.swift in your project.
  2. Congratulations!

Usage example

You can create a Gradient Button by

By using Storyboard or XIB

  1. Add button object and set custom class GradientButton

via Storyboard

  1. You can set the gradient colors and corner radius in the Attributes Inspector

via Attributes Inspector

By using code

import GradientButtonSwift

...

let button = GradientButton(frame: CGRect(x: 10, y: 20, width: 150, height: 40))
button.setTitle("Button", for: .normal)
button.topGradientColor = UIColor.red
button.bottomGradientColor = UIColor.orange
button.cornerRadius = 5
self.view.addSubview(button)

Contribute

We would love you for the contribution to GradientButtonSwift, check the LICENSE file for more info.

Meta

Royden Rego – @roydenrego[email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/roydenrego/GradientButtonSwift

Latest podspec

{
    "name": "GradientButtonSwift",
    "version": "1.0.2",
    "summary": "Library for applying gradients on UIButton",
    "description": "This button allows you to have a gradient on it specified by its top and bottom color.",
    "homepage": "https://github.com/roydenrego/GradientButtonSwift",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Royden Rego": "[email protected]"
    },
    "source": {
        "git": "https://github.com/roydenrego/GradientButtonSwift.git",
        "tag": "1.0.2"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "GradientButtonSwift/GradientButton.swift",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This