Created
August 11, 2017 17:07
-
-
Save ncreated/3e66568d8f8bfed7e67ecf1e6223896d to your computer and use it in GitHub Desktop.
Medium blogpost snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UISwitch { | |
func shake() { | |
transform = CGAffineTransform(translationX: 15, y: 0) | |
UIView.animate(withDuration: 0.4, delay: 0, usingSpringWithDamping: 0.2, initialSpringVelocity: 1, options: .curveEaseInOut, animations: { | |
self.transform = CGAffineTransform.identity | |
}, completion: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment