Skip to content
This repository was archived by the owner on Sep 18, 2026. It is now read-only.

Latest commit

 

History

History
83 lines (63 loc) · 3.8 KB

README.md

File metadata and controls

83 lines (63 loc) · 3.8 KB

UIAdvancedButton_GHHeader

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.

📲 Installation

CocoaPods:

pod 'UIAdvancedButton'

Swift Package Manager:

.package(url: "https://github.com/stevensyp/UIAdvancedButton.git")

🔠 Usage

// 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!")
}

🎨 Features

— Color (tintColor)

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.

— Color Style (colorStyle)

Property Detail Preview
.full (Default) Plain background color, and light/dark text. full
.medium Background with reduced opactiy, and colored text. medium
.neutral Light/dark background (.systemBackground), and colored text. neutral
.neutralGray Light gray background (.secondarySystemFill), and colored text. neutralGray
.system Clear background and colored text. system

— Content Layout (contentLayout)

Property Detail Preview
.horizontal (Default) Centered text, with the glyph at its left. horizontal
.horizontalReversed Centered text, with the glyph at its right. horizontalReversed
.horizontalReversedSpaced Left-aligned text, with right-aligned glyph. horizontalReversedSpaced

— Content Weight (isContentBold)

Defines if the content's weight of the button is semibold or regular. Default is true.

— Pressed Animation (isAnimatedWhenPressed)

The button will slightly shrink when pressed. Default is true.

— Tap Handling

The button supports two different ways to handle tapping inside its bounds.

  • button.tappedHandler = { ... } · Closure block.
  • button.addTarget(...) · Good old #selector.

Requirements & License

Requirements: Swift 5 · Xcode 12 · iOS 13

UIAdvancedButton is available under the MIT license. Please see the LICENSE file for more information.