TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Andrzej Michnia, Andrzej Michnia.
Customizable checkmark button view. Allows to easily animate between states, with optional intermediate “Spinning” state - if you want to beautifully morph betweeen two states, but need to wait for API in between. Clean and moder look, along with being easy-to-use. Support Swift 3.0.1.
Add button on storyboard, set its class to ASIACheckmarkView. Check the attributes inspector and play with the values, to get desired effect.
Note, that spinning animation does not work in storyboard IBDesignable.
Animating state change:
Swift
let checkmark: ASIACheckmarkView
func changeState() {
let newValue = !checkmark.boolValue // boolValue describes current checkmark state
checkmark.animate(checked: newValue) // animate to state you want
}
func changeStateWithCompletion() {
let newValue = !checkmark.boolValue // boolValue describes current checkmark state
checkmark.animateTo(newValue){
print("changed state to \(checkmark.boolValue)")
}
}
@IBAction func changeStateWithSpinner() {
let newValue = !checkmark.boolValue
checkmark.animate(checked: newValue) // animate to state you want
checkmark.isSpinning = true // PLACE THIS AFTER ANIMATE TO CALL!
}
func endSpinning() {
// OPTIONAL - You might call "checkmark.animate(checked: some_value)" here
// - if you want to alter state after finishing spinning
// (Yes -> spinning -> Yes) for example
checkmark.isSpinning = false
}
Created by Andrzej Michnia.
Animations design by Asia Michnia
ASIACheckmarkView is available under the MIT license. See the LICENSE file for more info.