2021-04-28 16:49:39 +02:00
|
|
|
Some legacy geometry functions can be replaced with struct extension properties or methods.
|
|
|
|
|
|
|
|
|
|
|
|
This rule raises an issue when any of the following substitutions can be made:
|
|
|
|
|
|
|
|
|
|
|
|
||Legacy Function||Preferred Replacement||
|
|
|
|
|
|
|
|
|``++CGRectGetWidth(rect)++``|``++rect.width++``|
|
|
|
|
|
|
|
|
|``++CGRectGetHeight(rect)++``|``++rect.height++``|
|
|
|
|
|
|
|
|
|``++CGRectGetMinX(rect)++``|``++rect.minX++``|
|
|
|
|
|
|
|
|
|``++CGRectGetMidX(rect)++``|``++rect.midX++``|
|
|
|
|
|
|
|
|
|``++CGRectGetMaxX(rect)++``|``++rect.maxX++``|
|
|
|
|
|
|
|
|
|``++CGRectGetMinY(rect)++``|``++rect.minY++``|
|
|
|
|
|
|
|
|
|``++CGRectGetMidY(rect)++``|``++rect.midY++``|
|
|
|
|
|
|
|
|
|``++CGRectGetMaxY(rect)++``|``++rect.maxY++``|
|
|
|
|
|
|
|
|
|``++CGRectIsNull(rect)++``|``++rect.isNull++``|
|
|
|
|
|
|
|
|
|``++CGRectIsEmpty(rect)++``|``++rect.isEmpty++``|
|
|
|
|
|
|
|
|
|``++CGRectIsInfinite(rect)++``|``++rect.isInfinite++``|
|
|
|
|
|
|
|
|
|``++CGRectStandardize++``|``++rect.standardized++``|
|
|
|
|
|
|
|
|
|``++CGRectIntegral(rect)++``|``++rect.integral++``|
|
|
|
|
|
|
|
|
|``++CGRectInset(rect, x, y)++``|``++rect.insetBy(dx: x, dy: y)++``|
|
|
|
|
|
|
|
|
|``++CGRectOffset(rect, x, y++``|``++rect.offsetBy(dx: x, dy: y++``|
|
|
|
|
|
|
|
|
|``++CGRectUnion(rect1, rect2)++``|``++rect1.union(rect2)++``|
|
|
|
|
|
|
|
|
|``++CGRectIntersection( rect1 ,rect2)++``|``++rect1.intersect(rect2)++``|
|
|
|
|
|
|
|
|
|``++CGRectContainsRect(rect1, rect2)++``|``++rect1.contains(rect2)++``|
|
|
|
|
|
|
|
|
|``++CGRectContainsPoint(rect, point)++``|``++rect.contains(point)++``|
|
|
|
|
|
|
|
|
|``++CGRectIntersectsRect(rect1, rect2)++``|``++rect1.intersects(rect2)++``|
|