Compositional layout

Generated on 8/12/2024

3 searches

Compositional layout is a concept used in both UIKit and SwiftUI to create flexible and dynamic user interfaces. In the context of UIKit, compositional layout is used to display content in different styles depending on the context, such as using an inset grouped appearance in portrait mode and a split view controller sidebar in landscape mode. This approach allows for dynamic content and background configurations based on the layout style, as seen in the implementation for iOS 17.

In SwiftUI, composition is a fundamental concept that allows for the creation of complex user interfaces by combining different views. SwiftUI supports creating lists and other UI elements using a declarative syntax, which can be composed using APIs like ForEach and view builders. This allows for flexible and dynamic UI construction, enabling developers to easily add and modify content without changing the underlying container implementation.

For more details on compositional layout in UIKit, you can refer to the session What’s new in UIKit (08:53). For SwiftUI, the session Demystify SwiftUI containers (03:07) provides insights into composition in SwiftUI.

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.

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.

Migrate your TVML app to SwiftUI

Migrate your TVML app to SwiftUI

SwiftUI helps you build great apps on all Apple platforms and is the preferred toolkit for bringing your content into the living room with tvOS 18. Learn how to use SwiftUI to create familiar layouts and controls from TVMLKit, and get tips and best practices.

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.

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.