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:
-
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.
-
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.
-
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.
-
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
What’s new in AppKit
Discover the latest advances in Mac app development. Get an overview of the new features in macOS Sequoia, and how to adopt them in your app. Explore new ways to integrate your existing code with SwiftUI. Learn about the improvements made to numerous AppKit controls, like toolbars, menus, text input, and more.
Platforms State of the Union
Discover the newest advancements on Apple platforms.
Bring expression to your app with Genmoji
Discover how to bring Genmoji to life in your app. We’ll go over how to render, store, and communicate text that includes Genmoji. If your app features a custom text engine, we’ll also cover techniques for adding support for Genmoji.