Each Emoji has a description that you can see in Mac OS\'s ⌃⌘Space
special character picker. There\'s a list of them here. Is there a way for me to query for th
Swift 3 version of Eric Aya's answer:
let s = "This is a
The Core Foundation function CFStringTransform()
has transformations that
determine the Unicode standard name for special characters. Example:
let c : Character = "
Martin R's answer using Core Foundation's CFStringTransform()
still works, but the key feature actually comes from kCFStringTransformToUnicodeName
, and in Swift 2 we can use it simply like this, by bridging with NSString
and calling stringByApplyingTransform
:
let c: Character = "
With Swift 5, you can use one of the two following ways in order to get the description of an Emoji character.
Unicode.Scalar.Properties
's name
propertyUnicode.Scalar.Properties
has a name property. name
has the following declaration:
var name: String? { get }
The published name of the scalar.
The Playground code sample below shows how to use name
in order to get the published name of a Unicode scalar:
let emoji: Character = "