alerts-and-pickers icon indicating copy to clipboard operation
alerts-and-pickers copied to clipboard

Cannot invoke initializer for type 'Range<_>' with an argument list of type '(Range<String.Index>)'

Open dabanlee opened this issue 5 years ago • 3 comments

image

image

image

dabanlee avatar Sep 12 '18 14:09 dabanlee

you can change this line

return String(self[NSRange(start ..< end)])

for this:

    let range: Range<Index> = start..<end
    return String(self[range])

Regards!!!

dan085 avatar Sep 19 '18 15:09 dan085

@dverdugo85 Thanks! Dev should update his code and example code

yarodevuci avatar Oct 03 '18 22:10 yarodevuci

you can change this line

return String(self[NSRange(start ..< end)])

for this:

    let range: Range<Index> = start..<end
    return String(self[range])

Regards!!!

After updating this, i've got this error: Type 'String.Index' does not conform to protocol 'FixedWidthInteger'

asar1 avatar Sep 21 '19 10:09 asar1