Elegant-Emoji-Picker icon indicating copy to clipboard operation
Elegant-Emoji-Picker copied to clipboard

Adopt Codable for Emoji & Emoji Category

Open RobertHaworth opened this issue 5 months ago • 3 comments

Edited the library to use the default implementations for Codable

The intent is once Emoji is marked as Codable, the structure is now storable using JSON encoding/decoding with ease.

  • Edited CodingKeys to have the custom strings used for "skin_tones" & "ios_version" without breaking the Emoji struct's naming pattern
  • Edited supportsSkinTones to be Optional Bool, as the key is missing on some Emoji's when loaded from the bundle.
  • Edited Picker function getAllEmoji's to return an empty array instead of crashing from a try!

RobertHaworth avatar Nov 02 '25 21:11 RobertHaworth

Of note, there are other strategies to remove the exposure of skin_tones being optional, but I am unsure of the preferences here.

This can easily be modified to have a custom decoder/encoder again to mask off this optional Bool if necessary.

RobertHaworth avatar Nov 02 '25 21:11 RobertHaworth

Thank you, Robert, very cool.

I'll take a deeper look soon, but on first glance looks good.

Finalet avatar Nov 13 '25 22:11 Finalet

Thank you, Robert, very cool.

I'll take a deeper look soon, but on first glance looks good.

I've made a fork and have been testing these changes in an app I am building, so can confirm they are stable & haven't caused issues (yet 😄 )

RobertHaworth avatar Nov 13 '25 23:11 RobertHaworth