Last active
June 21, 2017 09:01
-
-
Save shaps80/aab4548a408a887b6b65b339789e2e15 to your computer and use it in GitHub Desktop.
Returns a reversible rect, great for producing marquee selection rectangles.
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
| extension CGRect { | |
| public static func reversible(from: CGPoint, to: CGPoint) -> CGRect { | |
| let size = CGSize(width: to.x - from.x, height: to.y - from.y) | |
| return CGRect(origin: from, size: size).standardized | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment