Skip to content

Instantly share code, notes, and snippets.

@levi
Last active February 22, 2016 18:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levi/b97ded2b8ec4f20931b7 to your computer and use it in GitHub Desktop.
Save levi/b97ded2b8ec4f20931b7 to your computer and use it in GitHub Desktop.
CGFloat Degrees to Radians Operator (Option+Shift+8)
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