what is new in SwiftUI Text views in iOS 18

Generated on 8/1/2024

1 search

In iOS 18, SwiftUI Text views have received several notable updates:

  1. Programmatic Text Selection: SwiftUI now offers programmatic access to and control of text selection within text editing controls. This allows you to read properties of the selection, such as the selected ranges, and use this information to enhance user interactions, like showing suggested rhymes for selected words.

  2. Text Suggestions: You can now add text suggestions to any text field. These suggestions appear as a dropdown menu, and selecting an option updates the text field with the chosen completion.

  3. Custom Text Drawing: SwiftUI introduces the ability to customize how text is drawn for an entire view tree, enabling a range of custom text drawing possibilities, including animations. The core of this feature is the drawLayout method in the text renderer protocol, which allows access to individual components of the text, such as lines, runs, and glyphs.

  4. Improved Accessibility: SwiftUI has enhanced its accessibility features, allowing you to add additional information to built-in accessibility labels without overriding the framework-provided label.

For more details, you can refer to the session What’s new in SwiftUI (15:06).

Relevant Sessions

Create custom visual effects with SwiftUI

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 Dynamic Type

Get started with Dynamic Type

Dynamic Type lets people choose their preferred text size across the system and all of their apps. To help you get started supporting Dynamic Type, we’ll cover the fundamentals: How it works, how to find issues with scaling text in your app, and how to take practical steps using SwiftUI and UIKit to create a great Dynamic Type experience. We’ll also show how you can best use the Large Content Viewer to make navigation controls accessible to everyone.

What’s new in SwiftUI

What’s new in SwiftUI

Learn how you can use SwiftUI to build great apps for any Apple platform. Explore a fresh new look and feel for tabs and documents on iPadOS. Improve your window management with new windowing APIs, and gain more control over immersive spaces and volumes in your visionOS apps. We’ll also take you through other exciting refinements that help you make expressive charts, customize and layout text, and so much more.

Platforms State of the Union

Platforms State of the Union

Discover the newest advancements on Apple platforms.

What’s new in UIKit

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.

Build multilingual-ready apps

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.