Chapter 4: Typewriter Example

Using Xcode 14, in the second Typewriter example, for this line:

defer { index = phrase.index(after: index) } you now get the following error:

Main actor-isolated var 'index' can not be mutated from a non-isolated context

To fix the error, I changed the line to:

await MainActor.run { index = phrase.index(after: index) }

And everything works again as expected.

Thanks for reporting this, a lot of these have popped up in iOS16.