Search code examples
unicodeemojiswift

How are emoji flag characters represented in Swift strings?


Like some other emoji characters, the U+1F1E9 U+1F1EA combination (German flag, 🇩🇪) is represented as a single character on screen although it is really two different Unicode character points combined. Is it represented as one or two different characters in Swift?


Solution

  • let flag = "\u{1f1e9}\u{1f1ea}"
    

    then flag is 🇩🇪 .

    For more regional indicator symbols, see:
    http://en.wikipedia.org/wiki/Regional_Indicator_Symbol