A view of a string’s contents as a collection of Unicode scalar values.
- Xcode 6.0.1+
- Swift Standard Library
You can access a string’s view of Unicode scalar values by using its
unicode property. Unicode scalar values are the 21-bit codes that are the basic unit of Unicode. Each scalar value is represented by a
Unicode instance and is equivalent to a UTF-32 code unit.
Some characters that are visible in a string are made up of more than one Unicode scalar value. In that case, a string’s
unicode view contains more elements than the string itself.
You can convert a
String instance back into a string using the