Created
April 9, 2020 12:55
-
-
Save laevandus/07955ff394984bda6de4922734429c84 to your computer and use it in GitHub Desktop.
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
import CoreGraphics | |
extension CGRect { | |
init(center: CGPoint, size: CGSize) { | |
self.init(x: center.x - size.width / 2.0, y: center.y - size.height / 2.0, width: size.width, height: size.height) | |
} | |
var center: CGPoint { return CGPoint(x: midX, y: midY) } | |
} | |
extension CGSize { | |
var innerRadius: CGFloat { return min(width, height) / 2.0 } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment