Remix.run Logo
frollogaston 4 days ago

I'm well aware of all of this. Swift strings aren't random-access. There are reasons no other language did it Apple's way. Even in the rare situations when you do care about the edge cases with these multi-code point symbols (basically just emojis), Swift strings still make that a nightmare, while in other languages you have easy ways to deal with it.

I was on such a project where we cared a lot about these details, and the whole team agreed to throw Swift strings out the window and build our own array-based string replacement where each slot is a symbol. Which is probably what Apple would've done if it weren't for performance overhead.

Didn't help that their API was really unstable. Every major Swift version broke our code in so many places that we started adding extra layers just to protect ourselves.