lists or scrollview
Generated on 8/3/2024
1 search
Lists and ScrollViews in SwiftUI
Lists
- Session: SwiftUI essentials
- Lists in SwiftUI are powerful tools for view composition. They can be initialized with a collection parameter, which is a convenience for creating a
ForEach
view. This allows for generating views for each element in a collection and providing those to its container. - Lists can be customized with view modifiers, such as adding swipe actions to each row.
- Lists support sections using SwiftUI's
Section
view, which can include optional headers and footers.
- Lists in SwiftUI are powerful tools for view composition. They can be initialized with a collection parameter, which is a convenience for creating a
ScrollViews
-
Session: Migrate your TVML app to SwiftUI
- ScrollViews are used to create horizontally or vertically scrolling content. For example, a horizontally scrolling stack can be created using a
LazyHStack
embedded in aScrollView
. - New in tvOS 18 are several view modifiers specific to
ScrollView
, such as theonScrollVisibilityChange
modifier, which can be used to change the state when a header section scrolls off-screen. - ScrollViews can also be customized to remove background images when content moves below the fold, and to align scroll targets for smoother transitions.
- ScrollViews are used to create horizontally or vertically scrolling content. For example, a horizontally scrolling stack can be created using a
-
Session: Create custom visual effects with SwiftUI
- Scroll transitions can be used to create dynamic visual effects, such as parallax effects, by changing the x-offset of an image while keeping the clipping shape static.
- Scroll transitions can also be applied to other content, such as text captions, to create unique scroll experiences.
Additional Resources
- Session: Demystify SwiftUI containers
- Custom containers can be created to support sections and other advanced features. For example, a list can be customized to include headers and footers, and to modify the content of the container based on certain conditions.
Relevant Sessions
- SwiftUI essentials
- Migrate your TVML app to SwiftUI
- Create custom visual effects with SwiftUI
- Demystify SwiftUI containers
These sessions provide a comprehensive overview of how to use lists and scroll views in SwiftUI, along with advanced customization techniques.

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.

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
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.

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.