I am new to swift programming.I am working in an app of emoji.When i click an emoji from Apple keyboard it show the unicode of that emoji.How can i get this.
Asked
Active
Viewed 7,309 times
-4
-
If you want to get the unicode of a emoji in swift you should take a look at: https://stackoverflow.com/a/27278005/2164516 – Milander Jul 26 '18 at 12:26
2 Answers
3
Here is list of uicodes
https://apps.timwhitlock.info/emoji/tables/unicode
you can also use Edit->Emoji and drag the to the text
let str = "Ti \u{1F601} tle"

Shehata Gamal
- 98,760
- 8
- 65
- 87
-
When i click an emoji from Apple keyboard it show the unicode of that emoji.How can i get this. – Yaseen Khan Jul 26 '18 at 12:01
1
use Swift Unicode escape sequence concept:
let emojiString = "\u{1F4C4}"
and if you want to get all emoji's Unicode then try this
let emojiRanges = [
0x1F601...0x1F64F,
0x2702...0x27B0,
0x1F680...0x1F6C0,
0x1F170...0x1F251
]
for range in emojiRanges {
for i in range {
var c = String(UnicodeScalar(i))
print(c)
}
}

Mahesh Dangar
- 806
- 5
- 11
-
When i click an emoji from Apple keyboard it show the unicode of that emoji.How can i get this. – Yaseen Khan Jul 26 '18 at 12:01
-
@YaseenKhan just use that Unicode wherever you want like for eg if you want that emoji with your label then concat that emoji Unicode with your text message and assign to that label – Mahesh Dangar Jul 26 '18 at 12:12
-
-
I need the unicode when i press the emoji form the apple keyboard. – Yaseen Khan Jul 26 '18 at 12:22
-
@YaseenKhanI would like to send you the exact code but first let me know what exactly you want to archive? like I don't know what you want to do – Mahesh Dangar Jul 26 '18 at 12:22
-
I want that when the user press any one emoji from keyboard it show the unicode of the emoji that, this emoji is press and the unicode of that emoji is this... – Yaseen Khan Jul 26 '18 at 12:25
-
@YaseenKhan you can get directly from textFieldDelegateMethods for example . func textFieldShouldReturn(_ textField: UITextField) -> Bool { if textField == yourtextField { print(textField.text) }} – Mahesh Dangar Jul 26 '18 at 12:26
-
-
-
@YaseenKhan no need to thanks bro if that code works then please mark as true to my answer :) – Mahesh Dangar Jul 26 '18 at 12:33