Design / 21:10

Dive into lazy stacks and scrolling with SwiftUI

DesignSwiftUI & UI Frameworksiosipadosmacostvosvisionoswatchos

Key Points

  • Covers the inner workings of lazy stacks in SwiftUI.
  • Covers how LazyVStack and LazyHStack estimate sizes, lazily load subviews, and prefetch content to deliver smooth scrolling experiences.
  • Also covers advanced performance optimizations, state management best practices, and tips for precise programmatic scrolling.
  • Assumes basic familiarity with SwiftUI stack-based layout before diving into lazy stack behavior.
  • The session moves through Layout, Subview loading, Prefetching, Programmatic scrolling.
  • Key concepts include SwiftUI, LazyVStack, LazyHStack, ScrollView, ForEach, SwiftData, NetworkClient, Drag and Drop.

Condensed Flow

01

Layout:

Focuses on LazyVStack.

02

Subview loading:

Focuses on SwiftData, NetworkClient.

03

Prefetching:

Focuses on ScrollView.

04

Programmatic scrolling:

Focuses on SwiftUI.

More Detail

Additional details

  • Detailed flow: Layout -> Subview loading -> Prefetching -> Programmatic scrolling.
  • APIs and concepts to recognize: SwiftUI, LazyVStack, LazyHStack, ScrollView, ForEach, SwiftData, NetworkClient, Drag and Drop, StepViews, DiagramLoader, StepDiagram, StepInstructions.
  • Version and support notes focus on ContentUnavailableView.
  • Implementation focus: NetworkClient, ForEach, SwiftData.

Resources