View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vidéos

Ouvrir le menu Fermer le menu
  • Collections
  • Toutes les vidéos
  • À propos

Plus de vidéos

  • À propos
  • Code
  • Stacks, Grids, and Outlines in SwiftUI

    Display detailed data in your SwiftUI apps more quickly and efficiently with improved stacks and new list and outline views. Now available on iOS and iPadOS for the first time, outlines are a new multi-platform tool for expressing hierarchical data that work alongside stacks and lists. Learn how to use new and improved tools in SwiftUI to display more content on screen when using table views, create smooth-scrolling and responsive stacks, and build out list views for content that needs more than a vStack can provide. Take your layout options even further with the new grid view, as well as disclosure groups.

    To get the most out of this video, we recommend first checking out “SwiftUI App Essentials,” which provides an overview of everything new in SwiftUI for 2020. If you're brand-new to coding with SwiftUI, we also suggest watching 2019's “SwiftUI Essentials” talk.

    Ressources

    • View Layout and Presentation
      • Vidéo HD
      • Vidéo SD

    Vidéos connexes

    WWDC23

    • Analyze hangs with Instruments

    WWDC22

    • Compose custom layouts with SwiftUI

    WWDC20

    • App essentials in SwiftUI
    • Data Essentials in SwiftUI
    • What's new in SwiftUI

    WWDC19

    • SwiftUI Essentials
  • Rechercher dans cette vidéo…
    • 2:08 - Sandwich and HeroView

      // Sandwich model and gallery item view
      
      struct Sandwich: Identifiable {
          var id = UUID()
          var name: String
          var rating: Int
          var heroImage: Image { … }
      }
      
      struct HeroView: View {
          var sandwich: Sandwich
          var body: some View {
              sandwich.heroImage
                  .resizable()
                  .aspectRatio(contentMode: .fit)
                  .overlay(BannerView(sandwich: sandwich))
          }
      }
    • 2:26 - Sandwich Info Banner

      // Banner overlay view for sandwich info
      
      struct BannerView: View {
          var sandwich: Sandwich
          var body: some View {
              VStack(alignment: .leading, spacing: 10) {
                  Spacer()
                  TitleView(title: sandwich.name)
                  RatingView(rating: sandwich.rating)
              }
              .padding(…)
              .background(…)
          }
      }
    • 2:34 - Sandwich Rating View

      // Sandwich rating view
      
      struct RatingView: View {
          var rating: Int
          var body: some View {
              HStack {
                  ForEach(0..<5) { starIndex in
                      StarImage(isFilled: rating > starIndex)
                  }
                  Spacer()
              }
          }
      }
    • 2:39 - Scrollable Stack of HeroViews

      // Fetch sandwiches from the sandwich store
      let sandwiches: [Sandwich] = …
      
      ScrollView {
          VStack(spacing: 0) {
              ForEach(sandwiches) { sandwich in
                  HeroView(sandwich: sandwich)
              }
          }
      }
    • 3:53 - Scrollable Stack of HeroViews

      // Fetch sandwiches from the sandwich store
      let sandwiches: [Sandwich] = …
      
      ScrollView {
          VStack(spacing: 0) {
              ForEach(sandwiches) { sandwich in
                  HeroView(sandwich: sandwich)
              }
          }
      }
    • 3:57 - Scrollable Lazy Stack of HeroViews

      // Fetch sandwiches from the sandwich store
      let sandwiches: [Sandwich] = …
      
      ScrollView {
          LazyVStack(spacing: 0) {
              ForEach(sandwiches) { sandwich in
                  HeroView(sandwich: sandwich)
              }
          }
      }
    • 6:09 - Scrollable Lazy Stack of HeroViews

      // Fetch sandwiches from the sandwich store
      let sandwiches: [Sandwich] = …
      
      ScrollView {
          LazyVStack(spacing: 0) {
              ForEach(sandwiches) { sandwich in
                  HeroView(sandwich: sandwich)
              }
          }
      }
    • 6:18 - Three-Column Grid of Sandwiches

      // Fetch sandwiches from the sandwich store
      let sandwiches: [Sandwich] = …
      
      // Define grid columns
      var columns = [
          GridItem(spacing: 0),
          GridItem(spacing: 0),
          GridItem(spacing: 0)
      ]
      
      ScrollView {
          LazyVGrid(columns: columns, spacing: 0) {
              ForEach(sandwiches) { sandwich in
                  HeroView(sandwich: sandwich)
              }
          }
      }
    • 7:13 - Adaptive Grid of Sandwiches

      // Fetch sandwiches from the sandwich store
      let sandwiches: [Sandwich] = …
      
      // Define grid columns
      var columns = [
          GridItem(.adaptive(minimum: 300), spacing: 0)
      ]
      
      ScrollView {
          LazyVGrid(columns: columns, spacing: 0) {
              ForEach(sandwiches) { sandwich in
                  HeroView(sandwich: sandwich)
              }
          }
      }
    • 8:47 - Outline of GraphicRows

      struct GraphicsList: View {
          var graphics: [Graphic]
          var body: some View {
              List(
                  graphics,
                  children: \.children
              ) { graphic in
                  GraphicRow(graphic)
              }
              .listStyle(SidebarListStyle())
          }
      }
    • 9:52 - Customizing your outlines

      // Customizing your outlines
      
      List {
          ForEach(canvases) { canvas in
              Section(header: Text(canvas.name)) {
                  OutlineGroup(canvas.graphics, children: \.children)
                  { graphic in
                      GraphicRow(graphic)
                  }
              }
          }
      }
    • 13:10 - DisclosureGroup

      // Progressive display of information
      Form {
          DisclosureGroup(isExpanded: $areFillControlsShowing) {
             Toggle("Fill shape?", isOn: isFilled)
             ColorRow("Fill color", color: fillColor)
          } label: {
             Label("Fill", …)
          }
          …
      }

Developer Footer

  • Vidéos
  • WWDC20
  • Stacks, Grids, and Outlines in SwiftUI
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines