我的代码:
let myemoji = "\u{2049}"
let another = "\u{2757}"
Playground 结果:
Unicode U+2049 不会生成像这样的红色表情符号 ⁉️。 这种颜色有什么特别要添加的吗?
最佳答案
一些字符可以显示为“文本”或“表情符号”,并且 “Unicode VARIATION SELECTOR”可用于控制演示。 示例:
print("text presentation: \u{2049} \u{25B6}")
print("emoji presentation: \u{2049}\u{FE0F} \u{25B6}\u{FE0F}")
结果:
有关详细信息,请参阅 1.4.3 Emoji and Text Presentation Sequences :
ED-8. text presentation selector — The character U+FE0E VARIATION SELECTOR-15, used to request a text presentation for an emoji character. (Also known as text variation selector in prior versions of this specification.)
ED-9. emoji presentation selector — The character U+FE0F VARIATION SELECTOR-16, used to request an emoji presentation for an emoji character. (Also known as emoji variation selector in prior versions of this specification.)
An invisible codepoint which specifies that the preceding character should be displayed with emoji presentation. Only required if the preceding character defaults to text presentation.
关于swift - 如何显示彩色表情符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48534667/