Jan Kase
用于基于您屏幕的像素舍入的简单辅助工具。
获取舍入辅助工具的标准方法。
let rh = ScreenRounding().roundingHelper
对于舍入,可以使用以下舍入辅助工具上的方法
let ceil = rh.ceil(0.2)
let round = rh.round(0.2)
let floor = rh.floor(0.2)
还有一个标准Core graphics结构的扩展
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()