Код: Выделить всё
CGRect
Код: Выделить всё
let aRect = ... //get rect from somewhere
CGRect.null.union(aRect) //is aRect
CGRect.null.intersection(aRect) //is CGRect.null
Код: Выделить всё
CGPathВ
Код: Выделить всё
let bunchOfPaths = [...] //array of CGPaths
let unionPath = bunchOfPaths.reduce(CGPath.null, { $0.union($1) }) //union of all the paths
Код: Выделить всё
let nullRectPath = CGPath(rect: .null, transform: nil)
nullRectPath.isEmpty //false (?!)
let zeroRectPath = CGPath(rect: .zero, transform: nil)
nullRectPath.union(zeroRectPath) == zeroRectPath //false
Код: Выделить всё
let emptyPath = zeroRectPath.subtracting(zeroRectPath)
emptyPath.isEmpty //true
emptyPath.union(zeroRectPath) == zeroRectPath //false (!!)
Подробнее здесь: https://stackoverflow.com/questions/785 ... ath-on-ios