Sequences, storage, and why a string is not an array
Almost every program spends most of its time walking a sequence of things and doing something to
each one. Swift gives that a hierarchy of protocols rather than one Collection type, and where you
attach your own code to that hierarchy decides what it is allowed to promise and what it costs.
Text is where the difference bites hardest. A string looks like a collection of characters and behaves like one, but the character it hands back is a grapheme cluster of no fixed length — so the cheap operations you expect from an array are simply not there. What replaces them, and how to pick the view that makes your particular job cheap, is the second chapter.