What’s new attributed string
Generated on 8/5/2024
1 search
Apple introduced several new features related to attributed strings at WWDC 2024. Here are some highlights:
-
Text Attribute Protocol: In the session Create custom visual effects with SwiftUI, a new text attribute protocol was introduced alongside the text renderer in iOS 18. This protocol allows developers to pass data from their text to the text renderer, enabling custom visual effects.
-
Text Highlighting: The session What’s new in AppKit discussed new text highlighting features controlled by attributed string attributes. The
texthighlight
attribute corresponds to atexthighlightstyle
, which can be set to system default or customized with a color scheme. -
Text Highlight Feature in UIKit: Similarly, the session What’s new in UIKit introduced a new text highlight feature for UIKit. It uses
texthighlightstyle
andtexthighlight color scheme
attributes to render highlighted text with predefined or custom color schemes. -
Attributed Strings in Multilingual Apps: In the session Build multilingual-ready apps, it was highlighted that using color attributes in attributed strings can help differentiate parts of the text, especially in multilingual contexts where bold or italic styles may not be visually distinct.
-
Genmoji and Attributed Strings: The session Bring expression to your app with Genmoji explained how Genmoji, which are handled using attributed strings, can be integrated into custom text engines built with Textkit and Coretext.
These updates provide developers with more tools to create rich text experiences across Apple's 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.
Create custom visual effects with SwiftUI
Discover how to create stunning visual effects in SwiftUI. Learn to build unique scroll effects, rich color treatments, and custom transitions. We’ll also explore advanced graphic effects using Metal shaders and custom text rendering.
Get started with Writing Tools
Learn how Writing Tools help users proofread, rewrite, and transform text in your app. Get the details on how Writing Tools interact with your app so users can refine what they have written in any text view. Understand how text is retrieved and processed, and how to support Writing Tools in custom text views.
What’s new in UIKit
Explore everything new in UIKit, including tab and document launch experiences, transitions, and text and input changes. We’ll also discuss better-than-ever interoperability between UIKit and SwiftUI animations and gestures, as well as general improvements throughout UIKit.
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.
Build a spatial drawing app with RealityKit
Harness the power of RealityKit through the process of building a spatial drawing app. As you create an eye-catching spatial experience that integrates RealityKit with ARKit and SwiftUI, you’ll explore how resources work in RealityKit and how to use features like low-level mesh and texture APIs to achieve fast updates of the users’ brush strokes.
Build multilingual-ready apps
Ensure your app works properly and effectively for multilingual users. Learn best practices for text input, display, search, and formatting. Get details on typing in multiple languages without switching between keyboards. And find out how the latest advances in the String Catalog can make localization even easier.