Returns a sequence from a starting value to, but not including, an end value, stepping by the specified amount.
- Xcode 8.0+
- Swift Standard Library
The starting value to use for the sequence. If the sequence contains any values, the first one is
An end value to limit the sequence.
endis never an element of the resulting sequence.
The amount to step by with each iteration. A positive
strideiterates upward; a negative
A sequence from
start toward, but not including,
end. Each value in the sequence steps by
You can use this function to stride over values of any type that conforms to the
Strideable protocol, such as integers or floating-point types. Starting with
start, each successive value of the sequence adds
stride until the next value would be equal to or beyond
You can use
stride(from: to create a sequence that strides upward or downward. Pass a negative value as
stride to create a sequence from a higher start to a lower end:
If you pass a value as
stride that moves away from
end, the sequence contains no values.