In Swift 4, I'm getting this error when I try to take a Substring of a String using subscript syntax.
'subscript' is unavailable: cannot subscript String with a CountableClosedRange, see the documentation comment for discussion
For example:
let myString: String = "foobar"
let mySubstring: Substring = myString[1..<3]
Two questions:
- How can I resolve this error?
- Where is "the documentation comment for discussion" that was referred to in the error?