how is UIContentConfiguration composable?

Generated on 8/2/2024

1 search

UIContentConfiguration is composable in several ways, as highlighted in the What’s new in UIKit session. Here are the key points:

  1. Automatic Trait Tracking: UIContentConfiguration and UIBackgroundConfiguration now take advantage of the new list environment trait. This means that when updated for a new state, they adjust their properties to match the list environment from the configuration state's trait collection. This removes the need to know the style of the list when configuring a cell, simplifying the code.

  2. Automatic Updates: The existing cell subtitle, cell, and value cell configurations now automatically update their appearance based on the list environment trait. New header and footer configurations do the same, ensuring that the appearance is consistent and automatically updated.

  3. New Constructors: For UIBackgroundConfiguration, there are three new constructors: list cell, list header, and list footer. These configurations also update their appearance automatically from the list environment trait.

These features make UIContentConfiguration highly composable, allowing for flexible and dynamic UI updates without manual reconfiguration. This is particularly useful in applications like the Files app, which uses different styles for lists depending on the context (e.g., portrait vs. landscape).

For more details, you can refer to the List improvements chapter in the "What’s new in UIKit" session.

SwiftUI essentials

SwiftUI essentials

Join us on a tour of SwiftUI, Apple’s declarative user interface framework. Learn essential concepts for building apps in SwiftUI, like views, state variables, and layout. Discover the breadth of APIs for building fully featured experiences and crafting unique custom components. Whether you’re brand new to SwiftUI or an experienced developer, you’ll learn how to take advantage of what SwiftUI has to offer when building great apps.

Demystify SwiftUI containers

Demystify SwiftUI containers

Learn about the capabilities of SwiftUI container views and build a mental model for how subviews are managed by their containers. Leverage new APIs to build your own custom containers, create modifiers to customize container content, and give your containers that extra polish that helps your apps stand out.

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.

What’s new in Quick Look for visionOS

What’s new in Quick Look for visionOS

Explore how Quick Look in visionOS can elevate file preview and editing experiences in your app. We’ll cover the integration of in-app and windowed Quick Look, as well as a brand-new API that customizes the windowed Quick Look experience in your app. We’ll also share the latest enhancements to viewing 3D models within Quick Look.

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.