Returns a new value advanced by the given distance.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
Parameters
amountThe distance to advance this value.
Return Value
A new value that is amount added to this value.
Discussion
For two values x and d, the result of a x is equal to x + d—a new value y such that x approximates d. For example:
let x = 21.5
let y = x.advanced(by: -6.5)
// y == 15.0
print(x.distance(to: y))
// Prints "-6.5"