How to compose multi-character emoji from raw hex
问题 I'm getting JSON like this from the server: { "unicode":"1f468-1f468-1f467-1f467" } and I'm supposed to translate it into its composite character for display and/or copying to the pasteboard: 👨👨👧👧 The solution so far comes from this SO question: let u = json["unicode"] as? String let dashless = u.characters.split{$0 == "-"}.map(String.init) let charArray = dashless.map { char -> Character in let code = Int(strtoul(char, nil, 16)) return Character(UnicodeScalar(code)) } let unicode = String