Chapter 9: Possible errata in Converting Indexes Between Encoding Views section

The Xcode compiler advised unwrapping the optional ([arrowIndex!]) in the code below

Converting Indexes Between Encoding Views

As you saw earlier, you use indexes to access grapheme clusters in a string. For example, using the same string from above, you can do the following:

let arrowIndex = characters.firstIndex(of: "\u{21e8}")!
characters[arrowIndex] // ⇨

and the same in:

if let unicodeScalarsIndex = arrowIndex!.samePosition(in: characters.unicodeScalars) {



if let utf8Index = arrowIndex!.samePosition(in: characters.utf8) {

characters.utf8[utf8Index] // 226


if let utf16Index = arrowIndex!.samePosition(in: characters.utf16) {

characters.utf16[utf16Index] // 8680