I'm using the following code:
var continousDigitsRange:Range<Int> = Range<Int>(start: 0, end: 0)
Since update to Xcode 7.3 (Swift 2.2) I got the following hint:
'init(start:end:)' is deprecated: it will be removed in Swift 3. Use the '..<' operator.
For me is not clear how to "translate" it correctly with "using the '..<' operator.
You should simply write
var continousDigitsRange1:Range<Int> = 0..<0
or if you want to go even simpler
var continousDigitsRange = 0..<0
Also worth noting, to substringWithRange
a String, you can now use
let theString = "Hello, how are you"
let range = theString.startIndex.advancedBy(start) ..< theString.startIndex.advancedBy(end)
theString.substringWithRange(range)
The closed range operator
(a...b)
defines a range that runs from a to b, and includes the values a and b. The value of a must not be greater than b.The half-open range operator
(a..<b)
defines a range that runs from a to b, but does not include b. It is said to be half-open because it contains its first value, but not its final value. As with the closed range operator, the value of a must not be greater than b. If the value of a is equal to b, then the resulting range will be empty.
The Swift Programming Language (Swift 2.2) - Basic Operators
var continousDigitsRange:Range<Int> = Range<Int>(start: 0, end: 0)
--to--
var continousDigitsRange:Range<Int> = 0..<0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With