Swiftpack.co - stevensyp/UIAdvancedButton as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by stevensyp.
stevensyp/UIAdvancedButton 1.1.1
An efficient and accessible button, with different styles and parameters, written in Swift 5.
โญ๏ธ 1
๐Ÿ•“ 2 years ago
iOS
.package(url: "https://github.com/stevensyp/UIAdvancedButton.git", from: "1.1.1")

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.

GitHub

link
Stars: 1
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.1.1
2 years ago

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