Swiftpack.co -  stevensyp/UIAdvancedButton as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
stevensyp/UIAdvancedButton
An efficient and accessible button, with different styles and parameters, written in Swift 5.
.package(url: "https://github.com/stevensyp/UIAdvancedButton.git", from: "1.1.1")

UIAdvancedButton_GHHeader

Menu InstallationUsageFeatures

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.

GitHub

link
Stars: 1
Last commit: 5 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

1.1.1
5 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API