Swift UTF-8 String

Swift UTF-8 String

Swift 5 switches the preferred encoding of strings from UTF-16 to UTF-8 while preserving efficient Objective-C-interoperability. Prior to Swift 5, string content could be in one of two native storage encodings: UTF-16 for Unicode-rich text, and a dedicated ASCII storage class when contents are all ASCII. In Swift 4.2’s string model, a single non-ASCII scalar forces the entire content into UTF-16 storage.

Source: swift.org