APButton 6.0.2

APButton 6.0.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Mar 2024
SPMSupports SPM

Maintained by Anton Plebanovich.



APButton 6.0.2

  • By
  • Anton Plebanovich

APButton

Carthage compatible Version License Platform CI Status

Button with ability to show loading indicator and animate depended views according to button state. Try to mimic system button animations while provides ability to make button from several views: background view, image view, overlay view, etc.

Example

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

GIF animations

Activity indication:

Tap:

Installation

Carthage

If you are setting APButton class in storyboard assure module field is also APButton

Please check official guide

Cartfile:

github "APUtils/APButton"

CocoaPods

APButton is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'APButton'

Usage

Setup

Set custom class for your button in storyboard, assure module field is also APButton:

Add as many dependend views as you like:

Button outlet example:

@IBOutlet private weak var button: APButton!

Button action example:

@IBAction private func onButonTap(_ sender: APButton) {}

Configuration

You can set overlay color so instead of dim dependend views button will put overlay over self.

Setting rounded to On will make button corners rounded.

Activity

To start activity call button.startAnimating(), to finish call button.stopAnimating().

State changes

Button animations for taps are automatic.

If you want your dependend labels to change color for disabled state, their color should match APButton title color for state normal and their disabled state color will be APButton title color for state disabled then.

There are many ways and a lot of flexibility of how you can compose your button. See example project for more details.

Contributions

Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.

Author

Anton Plebanovich, [email protected]

License

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