Skip to content

Instantly share code, notes, and snippets.

@soffes
Created April 18, 2016 22:03
Show Gist options
  • Select an option

  • Save soffes/1b8e23314978c787bb12ea3a93c7ae10 to your computer and use it in GitHub Desktop.

Select an option

Save soffes/1b8e23314978c787bb12ea3a93c7ae10 to your computer and use it in GitHub Desktop.
import CoreGraphics
extension CGRect {
var floor: CGRect {
return CGRect(
x: CoreGraphics.floor(origin.x),
y: CoreGraphics.floor(origin.y),
width: CoreGraphics.floor(size.width),
height: CoreGraphics.floor(size.height)
)
}
var ceil: CGRect {
return CGRect(
x: CoreGraphics.ceil(origin.x),
y: CoreGraphics.ceil(origin.y),
width: CoreGraphics.ceil(size.width),
height: CoreGraphics.ceil(size.height)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment