Skip to content

Instantly share code, notes, and snippets.

@soggybag
Created May 6, 2016 14:21
Show Gist options
  • Save soggybag/f874aa0b8466b2cafc95dc38eba54996 to your computer and use it in GitHub Desktop.
Save soggybag/f874aa0b8466b2cafc95dc38eba54996 to your computer and use it in GitHub Desktop.
UIView Rotaton
extension UIView {
func rotateRad(r: CGFloat) {
self.transform = CGAffineTransformMakeRotation(r)
}
func rotateDeg(r: CGFloat) {
self.transform = CGAffineTransformMakeRotation(r.degreesToRadians)
}
}
// Include degrees to radians extension
// Usage
self.box.rotateRad(CGFloat(M_PI))
// or
self.box.rotateDeg(45)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment