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
  • Build complications in SwiftUI

    Spice up your graphic complications on Apple Watch using SwiftUI. We'll teach you how to use custom SwiftUI views in complications on watch faces like Meridian and Infograph, look at some best practices when creating your complications, and show you how to preview your work in Xcode 12.

    To get the most out of this session, you should be familiar with the basics of SwiftUI and building complications on Apple Watch. For an overview, watch “Create Complications for Apple Watch” and read “Building watchOS App Interfaces with SwiftUI.”

    Once you've discovered how to build graphic complications in SwiftUI, you can combine this with other watchOS 7 features like multiple complications and Face Sharing to create a watch face packed with personality and customized for people who love your app.

    Ressources

    • Creating and updating a complication’s timeline
    • Building a watchOS app
    • ClockKit
      • Vidéo HD
      • Vidéo SD

    Vidéos connexes

    WWDC22

    • Go further with Complications in WidgetKit

    WWDC21

    • Swift concurrency: Update a sample app

    WWDC20

    • Create complications for Apple Watch
    • Keep your complications up to date
    • Meet Watch Face Sharing
    • What's new in SwiftUI
  • Rechercher dans cette vidéo…
    • 3:17 - Relative Text

      import SwiftUI
      import ClockKit
      
      struct RelativeText: View {
          var body: some View {
              VStack(alignment: .leading) {
                  Text("Count Down")
                      .font(.headline)
                      .foregroundColor(.accentColor)
                  Label("Nap Time", systemImage: "moon.fill")
                  Text(Date() + 100, style: .relative)
              }
              .frame(maxWidth: .infinity, alignment: .leading)
          }
      }
      
      struct RelativeText_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicRectangularFullView(RelativeText())
                  .previewContext()
          }
      }
    • 3:26 - Timer Text

      import SwiftUI
      import ClockKit
      
      struct TimerText: View {
          var body: some View {
              VStack(alignment: .leading) {
                  Label("Sourdough Timer", systemImage: "timer")
                      .foregroundColor(.orange)
                  Text("Time remaining: \(Date() + 100, style: .timer)")
              }
              .frame(maxWidth: .infinity, alignment: .leading)
          }
      }
      
      struct TimerText_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicRectangularFullView(TimerText())
                  .previewContext()
          }
      }
    • 4:04 - Progress View Sample #1

      import SwiftUI
      import ClockKit
      
      struct ProgressSample: View {
          var body: some View {
              ProgressView(value: 0.7)
                  .progressViewStyle(CircularProgressViewStyle())
          }
      }
      
      struct ProgressSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicCircularView(ProgressSample())
                  .previewContext()
          }
      }
    • 4:15 - Progress View Sample #2

      import SwiftUI
      import ClockKit
      
      struct ProgressSample: View {
          var body: some View {
              ProgressView(value: 0.7) {
                  Image(systemName: "music.note")
              }
              .progressViewStyle(CircularProgressViewStyle())
          }
      }
      
      struct ProgressSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicCircularView(ProgressSample())
                  .previewContext()
          }
      }
    • 4:23 - Progress View Sample #3

      import SwiftUI
      import ClockKit
      
      struct ProgressSample: View {
          var body: some View {
              ProgressView(value: 0.7) {
                  Image(systemName: "music.note")
              }
              .progressViewStyle(CircularProgressViewStyle(tint: .red))
          }
      }
      
      struct ProgressSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicCircularView(ProgressSample())
                  .previewContext()
          }
      }
    • 4:29 - Progress View Sample #4

      import SwiftUI
      import ClockKit
      
      struct ProgressSample: View {
          var body: some View {
              VStack(alignment: .leading) {
                  Text("Water Reminder")
                      .foregroundColor(.blue)
                  Text("32 oz. consumed")
                  ProgressView(value: 0.7)
                      .progressViewStyle(LinearProgressViewStyle(tint: .blue))
              }
              
          }
      }
      
      struct ProgressSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicRectangularFullView(ProgressSample())
                  .previewContext()
          }
      }
    • 4:45 - Gauge Sample #1

      import SwiftUI
      import ClockKit
      
      struct GaugeSample: View {
          var body: some View {
              Gauge(value: 5.8, in: 3...10) {
                  Image(systemName: "drop.fill")
                      .foregroundColor(.green)
              }
              .gaugeStyle(CircularGaugeStyle())
          }
      }
      
      struct GaugeSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicCircularView(GaugeSample())
                  .previewContext()
          }
      }
    • 4:55 - Gauge Sample #2

      import SwiftUI
      import ClockKit
      
      struct GaugeSample: View {
          @State var acidity = 5.8
          
          var body: some View {
              Gauge(value: acidity, in: 3...10) {
                  Image(systemName: "drop.fill")
                      .foregroundColor(.green)
              } currentValueLabel: {
                  Text("\(acidity, specifier: "%.1f")")
              }
              .gaugeStyle(CircularGaugeStyle())
          }
      }
      
      struct GaugeSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicCircularView(GaugeSample())
                  .previewContext()
          }
      }
    • 5:02 - Gauge Sample #3

      import SwiftUI
      import ClockKit
      
      struct GaugeSample: View {
          @State var acidity = 5.8
          
          var body: some View {
              Gauge(value: acidity, in: 3...10) {
                  Image(systemName: "drop.fill")
                      .foregroundColor(.green)
              } currentValueLabel: {
                  Text("\(acidity, specifier: "%.1f")")
              } minimumValueLabel: {
                  Text("3")
              } maximumValueLabel: {
                  Text("10")
              }
              .gaugeStyle(CircularGaugeStyle())
          }
      }
      
      struct GaugeSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicCircularView(GaugeSample())
                  .previewContext()
          }
      }
    • 5:14 - Gauge Sample #4

      import SwiftUI
      import ClockKit
      
      struct GaugeSample: View {
          @State var acidity = 5.8
          
          var body: some View {
              Gauge(value: acidity, in: 3...10) {
                  Image(systemName: "drop.fill")
                      .foregroundColor(.green)
              } currentValueLabel: {
                  Text("\(acidity, specifier: "%.1f")")
              } minimumValueLabel: {
                  Text("3")
              } maximumValueLabel: {
                  Text("10")
              }
              .gaugeStyle(CircularGaugeStyle(tint: .green))
          }
      }
      
      struct GaugeSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicCircularView(GaugeSample())
                  .previewContext()
          }
      }
    • 5:21 - Gauge Sample #5

      import SwiftUI
      import ClockKit
      
      struct GaugeSample: View {
          @State var acidity = 5.8
          
          var body: some View {
              Gauge(value: acidity, in: 3...10) {
                  Image(systemName: "drop.fill")
                      .foregroundColor(.green)
              } currentValueLabel: {
                  Text("\(acidity, specifier: "%.1f")")
              } minimumValueLabel: {
                  Text("3")
              } maximumValueLabel: {
                  Text("10")
              }
              .gaugeStyle(
                  CircularGaugeStyle(
                      tint: Gradient(colors: [.orange, .yellow, .green, .blue, .purple])
                  )
              )
          }
      }
      
      struct GaugeSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicCircularView(GaugeSample())
                  .previewContext()
          }
      }
    • 5:34 - Gauge Sample #6

      import SwiftUI
      import ClockKit
      
      struct GaugeSample: View {
          @State var acidity = 5.8
          
          var body: some View {
              VStack(alignment: .leading) {
                  Text("Garden Soil Acidity")
                      .foregroundColor(.green)
                  Gauge(value: acidity, in: 3...10) {
                      Image(systemName: "drop.fill")
                          .foregroundColor(.green)
                  } currentValueLabel: {
                      Text("\(acidity, specifier: "%.1f")")
                  } minimumValueLabel: {
                      Text("3")
                  } maximumValueLabel: {
                      Text("10")
                  }
                  .gaugeStyle(
                      LinearGaugeStyle(
                          tint: Gradient(colors: [.orange, .yellow, .green, .blue, .purple])
                      )
                  )
              }
          }
      }
      
      struct GaugeSample_Previews: PreviewProvider {
          static var previews: some View {
              CLKComplicationTemplateGraphicRectangularFullView(GaugeSample())
                  .previewContext()
          }
      }

Developer Footer

  • Vidéos
  • WWDC20
  • Build complications 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