override func viewDidLoad() {
super.viewDidLoad()
let label = UILabel.init(frame: .init(x: 20, y: 200, width: 300, height: 60))
label.backgroundColor = .init(red: 0.8, green: 0.4, blue: 0.2, alpha: 0.4)
label.font = UIFont.systemFont(ofSize: 48)
self.view.addSubview(label)
let label2 = UILabel.init(frame: .init(x: 20, y: 280, width: 300, height: 60))
label2.backgroundColor = .init(red: 0.6, green: 0.8, blue: 0.2, alpha: 0.4)
label2.font = UIFont.systemFont(ofSize: 48)
self.view.addSubview(label2)
// 情况一
// U+1F601
//label.text = "\u{1F601}"
// U+1F1FA, U+1F1F8
//label.text = "\u{1F1FA}\u{1F1F8}"
//
label.text = "\u{1F601}\u{1F1FA}\u{1F1F8}"
// 情况二
//
let emojiStr = "\\ud83c\\udde8\\ud83c\\uddf3"
let str = "{\"emoji\":"+"\"\(emojiStr)\"}"
let data = Data.init(bytes: str, count: str.count)
let dic = try? JSONSerialization.jsonObject(with: data) as? [String : String]
label2.text = dic?["emoji"]
}