Last active
September 2, 2018 04:57
-
-
Save giginet/33f00a3bef859afca289fe5aa08a935c to your computer and use it in GitHub Desktop.
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
import UIKit | |
postfix operator ° | |
protocol IntegerInitializable: ExpressibleByIntegerLiteral { | |
init (_: Int) | |
} | |
extension Int: IntegerInitializable { | |
postfix public static func °(lhs: Int) -> CGFloat { | |
return CGFloat(Measurement(value: Double(lhs), unit: UnitAngle.degrees) | |
.converted(to: .radians).value) | |
} | |
} | |
let angle = 45° | |
let contentView = UIView() | |
contentView.transform = CGAffineTransform(rotationAngle: 45°) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment