The following properties are available in the Swift/iOS version of the JoyPixels library:
emojiVersion
(str) - Used only to direct CDN path. This is a 2-digit version (e.g. '5.0'). Not recommended for usage below 3.0.0.emojiDownloadSize
(enum) Default:128
- Used on to direct CDN path for non-sprite PNG usage to determine the size of the emoji image downloaded. Available options are '32', '64', and '128'.imagePathPNG
(str) Defaults to CDN (jsdelivr) path.greedyMatch
(bool) Default:false
- Whentrue
, matches non-fully-qualified Unicode values.ascii
(bool) Defaulttrue
- Whentrue
, matches ASCII characters (inunicodeToImage
andshortnameToImage
functions).riskyMatchAscii
(bool) Defaulttrue
- Whentrue
, matches ASCII characters not encapsulated by spaces. Can cause issues when matching (e.g.C://filepath
or<button>.</button>
both contain ASCII chars).
Below there are some examples of how you will actually use the libraries to convert Unicode emoji characters to :shortnames: and :shortnames: to emoji images.
client.toShortname(string) -> String
- native unicode -> shortnames
Take native unicode emoji input and translate it to their corresponding shortnames. (we recommend this for database storage)
client.shortnameToImage(string, imageSize, callback) -> SpannableStringBuilder
- shortname -> images
Take input containing shortnames and translate it directly to JoyPixels images for display in a spannable string. An imageSize parameter is used to set the size the size of the emoji images within the spannable string. A callback is made when all emoji have been retrieved from the imagePathPNG
CDN.
client.shortnameToUnicode(string) -> String
- shortname -> native unicode emoji
Take input containing shortnames and translate it directly to Unicode Emoji (when displaying the unified input to clients).
client.unicodeToImage(string, imageSize, callback) -> SpannableStringBuilder
- native unicode -> images
Take native unicode emoji input and translate it directly to JoyPixels images for display in a spannable string. An imageSize parameter is used to set the size of the emoji images within the spannable string. A callback is made when all emoji have been retrieved from the imagePathPNG
CDN.
client.toImage(string, imageSize, callback) -> SpannableStringBuilder
- native unicode + shortnames -> images
Take a string containing both native unicode emoji and shortnames, and translate it into JoyPixels images for display in a spannable string. An imageSize parameter is used to set the size of the emoji images within the spannable string. A callback is made when all emoji have been retrieved from the imagePathPNG
CDN.