Introduction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

You might be thinking: There’s actually no AI in this module. To get Genmoji into your app, you just need to provide a TextEditor that supports adaptive image glyph. The emoji keyboard does the rest. Once you’ve got text with Genmoji into your app, stored in an AttributedString, you need to display it, possibly modify it, and save it to disk in a way that preserves the Genmoji data.

In lesson 1, you used a TextEditor to get Genmoji input and copy-pasted this input into another TextEditor. The input is an AttributedString so you can display it in a Text view. It’s easier and more type-safe to modify attributes of an AttributedString than an NSAttributedString. On the other hand, saving NSAttributedString to disk is more robust and straightforward than AttributedString, especially with Swift Data. It’s just as easy to convert a modified AttributedString back to NSAttributedString, so you get the best of both worlds.

You can serialize NSAttributedString into several document formats, including RTFD, HTML and even Microsoft Word XML. And you can decompose an NSAttributedString to extract its adaptive image glyph data to use in non-rich-text formats.

Here’s what you’ll learn in this lesson:

  • How to display Genmoji in plain text and HTML formats.
  • How to serialize and deserialize an NSAttributedString while preserving its adaptive image glyphs.
See forum comments
Download course materials from Github
Previous: Conclusion Next: Instruction