Simple rounding helper for pixel rounding based on your screen.
Standard way to obtain rounding helper.
let rh = ScreenRounding().roundingHelperFor rounding is used method on rounding helper like following:
let ceil = rh.ceil(0.2)
let round = rh.round(0.2)
let floor = rh.floor(0.2)There is also extension of standard Core graphics structures:
let roundedPoint = CGPoint(x: 0.2, y: 2.0).round()
let ceilSize = CGSize(width: 0.2, height: 2.0).ceil()
let floorRect = CGRect(origin: CGPoint(x: 0.2, y: 2.0), size: CGSize(width: 0.2, height: 2.0)).floor()