将表情符号的 unicode 表示转换为实际的表情符号

Translating unicode representation of an emoji to an actual emoji

我正在尝试在我的 iOS 应用程序中添加对表情符号短代码的支持,以将其替换为实际的表情符号。例如,将 :+1: 变成 .我正在使用的数据位于 https://github.com/iamcal/emoji-data,我遇到的问题是它显示为 "unified": "1F44D",我不知道如何将其转换为实际的表情符号。

这个table中的“1F44D”是十六进制的unicode值。将其转换为整数,将其转换为 UnicodeScalar,将其转换为字符串或字符:

let unified = "1F44D"
if let value = Int(unified, radix: 16),
    let scalar = UnicodeScalar(value) {
    let string = String(scalar)
    print(string)
}