[swift-evolution] Add a stride(by:) method to ClosedRange
tvermeulen at me.com
Fri May 20 16:19:36 CDT 2016
If ClosedRange (Range in Swift 2.2.1) has a stride(by:) method, we can change
stride(from: 0, to: 10, by: 3)
and similarly, we can change
stride(from: 0, through: 10, by: 3)
As we can see, this syntax can replace both stride(from:to:by:) and stride(from:through:by:), and in my opinion it is more in line with the rest of Swift 3, similar to how Range.init(start:end:) will be deprecated in Swift 3 in favor of the … and ..< operators.
I’m not sure if this proposed stride(by:) method could replace all uses of stride(from:to:by:) and stride(from:through:by:), but I think that at the very least it would be a nice addition to the standard library.
More information about the swift-evolution