Add packages... → enter url →
How to use
Get an emoji
let emoji = await TextToEmoji.emoji(for: "tomato") // 🍅
This is an
async method that will
throw the error
noMatchFound if no emoji has been matched with the given text.
Get an emoji for a preferred category
let shrimp = TextToEmoji.emoji(for: "shrimp", preferredCategory: .foodAndDrink) // 🍤
let shrimp = TextToEmoji.emoji(for: "shrimp", preferredCategory: .animalsAndNature) // 🦐
preferredCategory, you can give a certain emoji category a higher priority. This can be very useful if you already know the context in which you are searching. For example, when looking for the word
shrimp, two matching emoji's could be:
.foodAndDrink as the
preferredCategory, the first match will be
.animalsAndNature would result in
EmojiCategory.swift for all categories.
Feel free to help me out here, especially with the localization.