Repository navigation
2.15 • Offset functions for points
For 2D points, you can now shift them around by offsetting them with these functions:
.offset(dx:dy:).offset(by:)+
Which you can use like this:
CGPoint(x: 20, y: 42).offset(dx: 7, dy: -5) == CGPoint(x: 27, y: 37)
IntPoint(x: 123, y: 456).offset(by: IntPoint(x: -200, -420)) == IntPoint(x: -77, 36)
UIntPoint.zero + UIntPoint(x: 6, y: 7) == UIntPoint(x: 6, y: 7)