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
  • The craft of SwiftUI API design: Progressive disclosure

    Explore progressive disclosure — one of SwiftUI's core principles — and learn how it influences the design of our APIs. We'll show you how we use progressive disclosure, discuss how it can support quick iteration and exploration, and help you take advantage of it in your own code.

    Ressources

      • Vidéo HD
      • Vidéo SD
  • Rechercher dans cette vidéo…
    • 1:59 - Declaration Site Example

      struct BookView: View {
          let pageNumber: Int
          let book: Book
      
          init(book: Book, pageNumber: Int) {
              self.book = book
              self.pageNumber = pageNumber
          }
      
          var body: some View { ... }
      }
    • 2:13 - Call Site Example

      VStack {
          BookView(book: favoriteBook, page: 1)
          BookView(book: savedBook, page: 234)
      }
    • 4:18 - Button Label

      Button("Next Page") {
          currentPage += 1
      }
    • 4:36 - Button label expanded

      Button {
          currentPage += 1
      } label: {
          Text("Next Page")
      }
    • 4:43 - Button label advanced case

      Button {
          currentPage += 1
      } label: {
          HStack {
              Text("Next Page")
              NextPagePreview()
          }
      }
    • 4:56 - Button label common case

      Button("Next Page") {
          currentPage += 1
      }
    • 5:30 - Text example

      Text("Hello WWDC22!")
    • 6:12 - Stacks of Text

      VStack {
          Text("Hello WWDC22!")
          Text("Call to Code.")
      }
    • 6:46 - Toolbar

      .toolbar {
          Button {
              addItem()
          } label: {
              Label("Add", systemImage: "plus")
          }
      
          Button {
              sort()
          } label: {
              Label("Sort", systemImage: "arrow.up.arrow.down")
          }
      
          Button {
              openShareSheet()
          }: label: {
              Label("Share", systemImage: "square.and.arrow.up")
          }
      }
    • 7:20 - Toolbar with explicit placement

      .toolbar {
          ToolbarItemGroup(placement: .navigationBarLeading) {
              Button {
                  addItem()
              } label: {
                  Label("Add", systemImage: "plus")
              }
      
              Button {
                  sort()
              } label: {
                  Label("Sort", systemImage: "arrow.up.arrow.down")
              }
      
              Button {
                  openShareSheet()
              }: label: {
                  Label("Share", systemImage: "square.and.arrow.up")
              }
          }
      }
    • 8:09 - Advanced use case table

      @State var sortOrder = [KeyPathComparator(\Book.title)]
      
      var body: some View {
          Table(sortOrder: $sortOrder) {
              TableColumn("Title", value: \Book.title) { book in
                  Text(book.title).bold()
              }
              TableColumn("Author", value: \Book.author) { book in
                  Text(book.author).italic()
              }
          } rows: {
              Section("Favorites") {
                  ForEach(favorites) { book in
                      TableRow(book)
                  }
              }
              Section("Currently Reading") {
                  ForEach(currentlyReading) { book in
                      TableRow(book)
                  }
              }
          }
          .onChange(of: sortOrder) { newValue in
              favorites.sort(using: newValue)
              currentlyReading.sort(using: newValue)
          }
      }
    • 8:41 - Simpler table use case

      @State var sortOrder = [KeyPathComparator(\Book.title)]
      
      var body: some View {
          Table(sortOrder: $sortOrder) {
              TableColumn("Title", value: \Book.title) { book in
                  Text(book.title)
              }
              TableColumn("Author", value: \Book.author) { book in
                  Text(book.author)
              }
          } rows: {
              ForEach(currentlyReading) { book in
                  TableRow(book)
              }
          }
          .onChange(of: sortOrder) { newValue in
              currentlyReading.sort(using: newValue)
          }
      }
    • 9:58 - Table collection convenience

      @State var sortOrder = [KeyPathComparator(\Book.title)]
      
      var body: some View {
          Table(currentlyReading, sortOrder: $sortOrder) {
              TableColumn("Title", value: \.title) { book in
                  Text(book.title)
              }
              TableColumn("Author", value: \.author) { book in
                  Text(book.author)
              }
          }
          .onChange(of: sortOrder) { newValue in
              currentlyReading.sort(using: newValue)
          }
      }
    • 10:23 - Table string key path convenience

      @State var sortOrder = [KeyPathComparator(\Book.title)]
      
      var body: some View {
          Table(currentlyReading, sortOrder: $sortOrder) {
              TableColumn("Title", value: \.title)
              TableColumn("Author", value: \.author)
          }
          .onChange(of: sortOrder) { newValue in
              currentlyReading.sort(using: newValue)
          }
      }
    • 10:51 - Table without sorting

      var body: some View {
          Table(currentlyReading) {
              TableColumn("Title", value: \.title)
              TableColumn("Author", value: \.author)
          }
      }
    • 13:37 - Stack example: leading

      struct StackExample: View {
          var body: some View {
              HStack { // leading
                  Box().tint(.red)
                  Box().tint(.green)
                  Box().tint(.blue)
              }
          }
      }
    • 13:40 - Stack example: centered

      struct StackExample: View {
          var body: some View {
              HStack { // centered
                  Spacer()
                  Box().tint(.red)
                  Box().tint(.green)
                  Box().tint(.blue)
                  Spacer()
              }
          }
      }
    • 13:42 - Stack example: evenly spaced

      struct StackExample: View {
          var body: some View {
              HStack { // evenly spaced
                  Spacer()
                  Box().tint(.red)
                  Spacer()
                  Box().tint(.green)
                  Spacer()
                  Box().tint(.blue)
                  Spacer()
              }
          }
      }
    • 13:43 - Stack example: space only between elements

      struct StackExample: View {
          var body: some View {
              HStack { // space only between elements
                  Box().tint(.red)
                  Spacer()
                  Box().tint(.green)
                  Spacer()
                  Box().tint(.blue)
              }
          }
      }
    • 13:46 - Stack example: space only before last element

      struct StackExample: View {
          var body: some View {
              HStack { // space only before last element
                  Box().tint(.red)
                  Box().tint(.green)
                  Spacer()
                  Box().tint(.blue)
              }
          }
      }
    • 13:47 - Stack example: space only after first element

      struct StackExample: View {
          var body: some View {
              HStack { // space only after first element
                  Box().tint(.red)
                  Spacer()
                  Box().tint(.green)
                  Box().tint(.blue)
              }
          }
      }

Developer Footer

  • Vidéos
  • WWDC22
  • The craft of SwiftUI API design: Progressive disclosure
  • 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