Last active
December 12, 2018 18:45
-
-
Save michaeleisel/4f5099c5745a746e34cad6fe3767b501 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
extension CGRect { | |
var isAligned: Bool { | |
get { | |
return origin.x.isAligned && origin.y.isAligned && size.width.isAligned && size.height.isAligned | |
} | |
} | |
} | |
extension CGFloat { | |
var isAligned: Bool { | |
get { | |
let (_, errorPart) = modf(self * UIScreen.main.scale) | |
return errorPart < 0.001 | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment