All Projects → tungvoduc → Dtgradientbutton

tungvoduc / Dtgradientbutton

Licence: mit
Easy way to set gradient background to your buttons.

Programming Languages

swift
15916 projects
swift4
162 projects

Projects that are alternatives of or similar to Dtgradientbutton

Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+13986.84%)
Mutual labels:  xcode, cocoapods, swift-package-manager, uikit
Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (+1167.11%)
Mutual labels:  xcode, cocoapods, swift-package-manager, uikit
Containercontroller
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version
Stars: ✭ 273 (+259.21%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Skeletonui
☠️ Elegant skeleton loading animation in SwiftUI and Combine
Stars: ✭ 275 (+261.84%)
Mutual labels:  cocoapods, swift-package-manager, gradient
Tweetextfield
Lightweight set of text fields with nice animation and functionality. 🚀 Inspired by https://uimovement.com/ui/2524/input-field-help/
Stars: ✭ 421 (+453.95%)
Mutual labels:  cocoapods, swift-package-manager, uikit
Dtphotoviewercontroller
A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.
Stars: ✭ 212 (+178.95%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Dtpagercontroller
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.
Stars: ✭ 240 (+215.79%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Stepslider
StepSlider its custom implementation of slider such as UISlider for preset integer values.
Stars: ✭ 391 (+414.47%)
Mutual labels:  xcode, cocoapods, uikit
Cyltabbarcontroller
[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
Stars: ✭ 6,605 (+8590.79%)
Mutual labels:  xcode, cocoapods, uikit
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (+1452.63%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Statusalert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.
Stars: ✭ 809 (+964.47%)
Mutual labels:  cocoapods, swift-package-manager, uikit
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (+107.89%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (+72.37%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Roundcode
Custom rounded QR code with lots of customization.
Stars: ✭ 267 (+251.32%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Alamofire
Elegant HTTP Networking in Swift
Stars: ✭ 36,896 (+48447.37%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Swift5 Module Template
An opinionated starting point for awesome, reusable Swift 5 modules
Stars: ✭ 331 (+335.53%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (+18.42%)
Mutual labels:  xcode, cocoapods, swift-package-manager
Ttsegmentedcontrol
An elegant, animated and customizable segmented control for iOS created by Tapptitude
Stars: ✭ 471 (+519.74%)
Mutual labels:  xcode, cocoapods, uikit
Bfkit
BFKit is a collection of useful classes and categories to develop Apps faster.
Stars: ✭ 811 (+967.11%)
Mutual labels:  xcode, cocoapods, uikit
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-59.21%)
Mutual labels:  xcode, cocoapods, swift-package-manager

DTGradientButton

Version License Platform

Screenshot


Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

To set gradient colors as background for a button, just use it as below:

let colors = [UIColor(hex: "FF8960"), UIColor(hex: "FF62A5")]
button.setGradientBackgroundColors(colors, direction: .toRight, for: .normal)

Method setGradientBackgroundColors(_ colors:, direction:, for state:) is provided as an extended method of UIButton. For that reason, you can use it for any UIButton instance in your project.

Eight predefined directions are supported for the gradient.

public enum DTImageGradientDirection {
    case toLeft
    case toRight
    case toTop
    case toBottom
    case toBottomLeft
    case toBottomRight
    case toTopLeft
    case toTopRight
}

Besides setting gradient background for UIButton, you can take advantage of this library to create gradient image as below:

let colors = [UIColor(hex: "FF8960"), UIColor(hex: "FF62A5")]
let image = UIImage(size: CGSize(width: 100, height: 100), direction: .toBottom, colors: colors)

Requirements

iOS 8.0

Installation

CocoaPods

Add the following line to your Podfile:

pod 'DTGradientButton'

Swift package manager

DTGradientButton is available for SPM from version 0.1.3. Add the following to the dependencies of your Package.swift:

.package(url: "https://github.com/tungvoduc/DTGradientButton", from: "version")

Author

Tung Vo, [email protected]

License

DTGradientButton is available under the MIT license. See the LICENSE file for more info.

Feedbacks & requests

  • Open an issue if you find a bug, make a proposal or simply need some help.
  • You can also contact me via email.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].