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.
To run the example project, clone the repo, and run pod install
from the Example directory first.
APButton is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'APButton', '~> 6.0'
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) {}
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.
To start activity call button.startAnimating()
, to finish call button.stopAnimating()
.
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.
Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.
Anton Plebanovich, anton.plebanovich@gmail.com
APButton is available under the MIT license. See the LICENSE file for more info.