How do I generate emoji

Generated on 7/31/2024

1 search

To generate emoji, Apple has introduced a new feature called Genmoji. This allows you to create custom emoji that can be used in your applications. Here are the key points on how to generate and use Genmoji:

  1. NSAdaptiveImageGlyph API: This new API supports using Genmoji and other personalized images. Genmoji are unique rasterized bitmaps that can't be described by a Unicode text character. They are powered by a standard image format in a square aspect ratio with multiple resolutions and additional metadata for accessibility and proper layout.

  2. Integration with Text Systems: If you are already using standard text systems with inline images, you can easily integrate Genmoji. You just need to set one property to accept Genmoji from the keyboard. Genmoji are handled using attributed strings, which is a data type for representing rich text with graphics.

  3. Serialization and Storage: Genmoji support is enabled by default in text views backed by rich text data. You can serialize the content of the text view into an RTFD data object and store it in your database. When displaying the content again, you can create an attributed string from the stored data.

  4. Web and Notifications: For web interfaces, you can convert the attributed strings to HTML, which will display the image in line with text. For notifications, you can include Genmoji using the new UNNotificationAttributedMessageContext API for push notifications.

For a detailed walkthrough on how to adopt custom emoji in your app, you can watch the session Bring expression to your app with Genmoji.

Relevant Sessions