Created
January 9, 2018 10:27
-
-
Save lamlv2305/df82deb3ee1195b4af7c3131740ea16e to your computer and use it in GitHub Desktop.
[SWIFT 4.0] Autoclosure example
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 UIView { | |
static func animate(duration: TimeInterval, _ animations: @autoclosure @escaping () -> Void) { | |
UIView.animate(withDuration: duration, animations: { animations() }) | |
} | |
} | |
UIView.animate(duration: 0.1, self.view.backgroundColor = UIColor.red) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment