Returns an index that is the specified distance from the given index.
- Xcode 8.0+
A valid index of the collection.
The distance to offset
An index offset by
n from the index
n is positive, this is the same value as the result of
n calls to
n is negative, this is the same value as the result of
-n calls to
The following example obtains an index advanced four positions from a string’s starting index and then prints the character at that position.
The value passed as
n must not offset
i beyond the bounds of the collection.
Complexity: O(n), where n is the absolute value of