Menu → Installation • Usage • Features
UIAdvancedButton
is an open-source subclass of UIKit's UIControl implemented as a ready-to-use button, coming with different styles, animations, and parameters. It is designed to be permormant and accessible.
pod 'UIAdvancedButton'
.package(url: "https://github.com/stevensyp/UIAdvancedButton.git")
// 1 - Import the framework
import UIAdvancedButton
// 2 - Instantiate the button through IB or code
let button = UIAdvancedButton()
@IBOutlet weak var button: UIAdvancedButton!
// 3 - Customize the properties
button.title = "Press Me"
button.glyph = UIImage(systemName: "hand.tap.fill")
button.set(colorStyle: .medium, contentLayout: .horizontalReversedSpaced)
button.cornerRadius = 8
// 4 - Define an action when pressed
button.tappedHandler = {
print("Button pressed!")
}
UIAdvancedButton uses only its tintColor
to define its color layout (background and/or text color) depending on the selected colorStyle
. You can still set border color independently. Changing backgroundColor
won't have any effect. Default is systemBlue
.
Defines if the content's weight of the button is semibold
or regular
. Default is true
.
The button will slightly shrink when pressed. Default is true
.
The button supports two different ways to handle tapping inside its bounds.
button.tappedHandler = { ... }
· Closure block.button.addTarget(...)
· Good old#selector
.
Requirements: Swift 5 · Xcode 12 · iOS 13
UIAdvancedButton
is available under the MIT license. Please see the LICENSE file for more information.