Finalet / Elegant-Emoji-Picker

Aesthetic, simple, and powerful emoji picker for Swift built with UIKit.
MIT License
64 stars 16 forks source link

Recent Emojis #7

Open hidoon opened 1 year ago

hidoon commented 1 year ago

Will there be recent emojis category?

Finalet commented 1 year ago

In a hypothetical future when all starts align.

For now though, you can extend functionality your self with emojiPicker(_: loadEmojiSections : withConfiguration : withLocalization) to insert your own recent emojis category.

hidoon commented 1 year ago

It seems like loadEmojiSections replaces all other emojis. I wish I was able to just add another category section. Thanks so much for reply btw.

Finalet commented 1 year ago

You can get all emojis with ElegantEmojiPicker.getAllEmoji(), but they will not be sorted into categories.

For now, you can fork the repo and modify the private setupEmojiSections(config: ElegantConfiguration, localization: ElegantLocalization) method to insert your recent emoji section.

Its a good idea for me to make it public. Thanks.

hidoon commented 1 year ago

I forked and changed the code as you said. Thanks a lot!

image
Finalet commented 1 year ago

Great! I'll make methods public later so you could do this natively.

Finalet commented 1 year ago

getDefaultEmojiSections() is now public, so you can append your section natively like so:

func emojiPicker(_ picker: ElegantEmojiPicker, loadEmojiSections withConfiguration: ElegantConfiguration, _ withLocalization: ElegantLocalization) -> [EmojiSection] {
    let allEmojis = ElegantEmojiPicker.getAllEmoji()

    let politeEmojis = allEmojis.filter({
        $0.emoji == "🖕" ||
        $0.emoji == "👊" ||
        $0.emoji == "🤬"
    })

    return [EmojiSection(title: "Politeness", icon: UIImage(systemName: "heart"), emojis: politeEmojis)] + ElegantEmojiPicker.getDefaultEmojiSections(config: withConfiguration, localization: withLocalization)
}
hidoon commented 1 year ago

Thanks so much for your responsive behaviour 🚀