The Apple’s documentation states that
A string object is implemented as an array of Unicode characters
However, the size of unichar data type, which is likely to be unsigned short behind the scenes, is only 16 bits, which renders impossible to represent every Unicode character with unichar. How do I reconcile these two facts in my mind?
You are correct that Apple’s docs incorrectly refer to Unicode characters when it really means UTF-16 code points.
In the early days of Unicode it was hoped that it would not exceed 16 bits, but it has. Both Apple and Microsoft (and probably others) use 16-bit integers to represent “Unicode characters”, even though some characters will have to be represented by surrogate pairs.
Various methods of
NSStringhandle this case (plus combining characters) and return a range for a given character. E.g.-rangeOfCharacterFromSet:...and-rangeOfComposedCharacterSequences....