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
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Go further with Complications in WidgetKit

    Discover how you can use WidgetKit to create beautiful complications on watch faces. We'll introduce you to the watchOS-specific features found in WidgetKit, and help you migrate from existing ClockKit complications.

    For more on WidgetKit, watch “Complications and Widgets: Reloaded” from WWDC22.

    Recursos

    • Migrating ClockKit complications to WidgetKit
    • Creating accessory widgets and watch complications
    • Emoji Rangers: Supporting Live Activities, interactivity, and animations
    • WidgetKit
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    Tech Talks

    • What's new for enterprise developers

    WWDC22

    • Complications and widgets: Reloaded
    • WWDC22 Day 3 recap

    WWDC20

    • Build complications in SwiftUI
    • Meet WidgetKit
  • Buscar neste vídeo...
    • 3:06 - Large Corner

      struct CornerView: View {
          let value: Double
      
          var body: some View {
      
              ZStack {
                  AccessoryWidgetBackground()
                  Image(systemName: "cup.and.saucer.fill")
                      .font(.title.bold())
                      .widgetAccentable()
              }
      
          }
      }
    • 3:27 - Corner with Gauge

      struct CornerView: View {
          let value: Double
      
          var body: some View {
      
              ZStack {
                  AccessoryWidgetBackground()
                  Image(systemName: "cup.and.saucer.fill")
                      .font(.title.bold())
                      .widgetAccentable()
              }
              .widgetLabel {
                  Gauge(value: value,
                    in: 0...500) {
                      Text("MG")
                  } currentValueLabel: {
                      Text("\(Int(value))")
                  } minimumValueLabel: {
                      Text("0")
                  } maximumValueLabel: {
                      Text("500")
                  }
              }
      
      
          }
      }
    • 4:24 - Circular Gauge

      struct CircularView: View {
          let value: Double
      
          var body: some View {
      
              Gauge(value: value,
                    in: 0...500) {
                  Text("MG")
              } currentValueLabel: {
                  Text("\(Int(value))")
              }
              .gaugeStyle(.circular)
      
          }
      }
    • 4:34 - Circular Gauge with Widget Label

      struct CircularView: View {
          let value: Double
      
          var body: some View {
              let mg = value.inMG()
      
              Gauge(value: value,
                    in: 0...500) {
                  Text("MG")
              } currentValueLabel: {
                  Text("\(Int(value))")
              }
              .gaugeStyle(.circular)
              .widgetLabel {
                  Text("\(mg, formatter: mgFormatter) Caffeine")
              }
      
          }
      
          var mgFormatter: Formatter {
              let formatter = MeasurementFormatter()
              formatter.unitOptions = [.providedUnit]
              return formatter
          }
      }
      
      extension Double {
          func inMG() -> Measurement<UnitMass> {
              Measurement<UnitMass>(value: self, unit: .milligrams)
          }
      }
    • 4:51 - Circular Stack with Widget Label

      struct CircularView: View {
          let value: Double
      
          var body: some View {
              let mg = value.inMG()
      
              ZStack {
                  AccessoryWidgetBackground()
                  Image(systemName: "cup.and.saucer.fill")
                      .font(.title.bold())
                      .widgetAccentable()
              }
              .widgetLabel {
                  Text("\(mg, formatter: mgFormatter) Caffeine")
              }
      
          }
      
          var mgFormatter: Formatter {
              let formatter = MeasurementFormatter()
              formatter.unitOptions = [.providedUnit]
              return formatter
          }
      }
      
      extension Double {
          func inMG() -> Measurement<UnitMass> {
              Measurement<UnitMass>(value: self, unit: .milligrams)
          }
      }
    • 5:12 - Circular Stack or Gauge

      struct CircularView: View {
          let value: Double
          @Environment(\.showsWidgetLabel) var showsWidgetLabel
      
          var body: some View {
              let mg = value.inMG()
              if showsWidgetLabel {
                  ZStack {
                      AccessoryWidgetBackground()
                      Image(systemName: "cup.and.saucer.fill")
                          .font(.title.bold())
                          .widgetAccentable()
                  }
                  .widgetLabel {
                      Text("\(mg, formatter: mgFormatter) Caffeine")
                  }
              }
              else {
                  Gauge(value: value,
                        in: 0...500) {
                      Text("MG")
                  } currentValueLabel: {
                      Text("\(Int(value))")
                  }
                  .gaugeStyle(.circular)
              }
      
          }
      
          var mgFormatter: Formatter {
              let formatter = MeasurementFormatter()
              formatter.unitOptions = [.providedUnit]
              return formatter
          }
      }
      
      extension Double {
          func inMG() -> Measurement<UnitMass> {
              Measurement<UnitMass>(value: self, unit: .milligrams)
          }
      }
    • 9:47 - Widget Migrator

      var widgetMigrator: CLKComplicationWidgetMigrator {
          self
      }
    • 9:56 - Static Migration Configuration

      func widgetConfiguration(from complicationDescriptor: CLKComplicationDescriptor) async -> CLKComplicationWidgetMigrationConfiguration? {
          CLKComplicationStaticWidgetMigrationConfiguration(kind: "CoffeeTracker", extensionBundleIdentifier: widgetBundle)
      }
    • 10:03 - Intent Migration Configuration

      func widgetConfiguration(from complicationDescriptor: CLKComplicationDescriptor) async -> CLKComplicationWidgetMigrationConfiguration? {
          CLKComplicationIntentWidgetMigrationConfiguration(kind: "CoffeeTracker", extensionBundleIdentifier: widgetBundle, intent: intent, localizedDisplayName: "Coffee Tracker")
      }

Developer Footer

  • Vídeos
  • WWDC22
  • Go further with Complications in WidgetKit
  • 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