With the Swift 5 compiler changing
String's native representation to be backed by UTF-8, code that wants to operate as fast as possible on
String code units should naturally use UTF-8. However if the
String is bridged from
NSString then the backing representation will still be UTF-16.
Is there any supported way to detect if a given
String is backed by UTF-8 or UTF-16, so I can pick the appropriate implementation?