Last active
February 22, 2016 18:20
-
-
Save levi/b97ded2b8ec4f20931b7 to your computer and use it in GitHub Desktop.
CGFloat Degrees to Radians Operator (Option+Shift+8)
This file contains hidden or 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
postfix operator ° {} | |
postfix func ° (degrees: CGFloat) -> CGFloat { | |
return degrees * CGFloat(M_PI / 180.0) | |
} | |
// Example usage | |
let view = UIView() | |
view.transform = CGAffineTransformMakeRotation(45°) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment