Streaming is available in most browsers,
and in the Developer app.
-
What’s new in watchOS 11
Explore new opportunities on Apple Watch, including bringing Double Tap support to your watchOS app, making your Smart Stack widgets even more relevant and interactive, and displaying your iOS Live Activities in the Smart Stack.
Chapters
- 0:00 - Intro
- 1:00 - Live Activities
- 2:29 - Widgets
- 10:33 - Double tap
- 12:29 - Health and fitness
Resources
- Enabling the double-tap gesture on Apple Watch
- Forum: UI Frameworks
- Human Interface Guidelines: watchOS
- Human Interface Guidelines: Widgets
- WidgetKit
Related Videos
WWDC24
-
Download
Hello, my name is Erena Inoue and I am an engineer on the watchOS Smart Stack team. watchOS 11 is full of new features that make Apple Watch even more personal, intelligent, and convenient. In this session, I will be talking about how you can take advantage of these same features in your apps. We’ll cover how iOS Live Activities appear on Apple Watch, and how you can customize its experience for watchOS.
Next, we will talk about how interactivity and relevance come together to make widgets more actionable and the Smart Stack more intelligent.
Then, we will see how Double tap can be used to navigate and take action in your app.
After that, we will review some enhancements to HealthKit and WorkoutKit.
There’s a lot to cover, so let’s get started with Live Activities.
A Live Activity provides a glanceable way to track the progress of an event or task straight from the iPhone Lock Screen.
In watchOS 11, Live Activities from your iOS app are available in the Smart Stack on Apple Watch, even if you don’t have a watchOS app yet.
With no changes to your code at all, your leading and trailing views from the Dynamic Island will automatically appear in the Smart Stack.
You can provide custom content for the Smart Stack on Apple Watch by specifying that your Live Activity supports the small supplemental activity family. When you add the .supplementalActivityFamilies modifier to the ActivityConfiguration, the system will prefer your custom content view over the Dynamic Island views.
You can then use the Environment to further customize the layout of your Live Activity view for watchOS. Use the .small family for the Smart Stack or the .medium family for the Lock Screen on iOS and iPadOS.
Live Activities are an exciting new way to bring rich and glanceable information to the Smart Stack.
For more information on how to provide a great Live Activity experience on Apple Watch, be sure to check out these sessions.
Continuing with the richer experience in the Smart Stack, there are many new features in Widgets! Let’s start with Relevant Widgets.
watchOS 10 introduced the Smart Stack, a customizable stack of widgets accessible from any watch face with just a turn of the digital crown.
In watchOS 11, your widget can automatically appear in the Smart Stack when it is most relevant if you provide the system with a few context clues. Use the App Intent RelevantContext API to let the system know when your widget is likely to be most relevant. You can provide relevant contexts such as Date, Inferred or precise location, Sleep, including the bedtime and wakeup time Fitness cues, including active workout and incomplete activity rings and more that you can find in the documentation! Let’s take a look at how to use RelevantContext in your widgets with an example from the Reminders app.
First, implement the new relevances() method in your widget’s TimelineProvider.
Next, define a RelevantContext. Reminders in our list can have a due date or an associated date interval. Therefore, we’ll use a date relevant context.
Wrap the context you just created in a new WidgetRelevanceEntry type and return the WidgetRelevances, which wraps the WidgetRelevanceEntry you just created.
You can also do something similar with other relevant contexts. For example, if you have a sleep data widget, it might be relevant to someone after they wake up. You can use the .sleep relevant context to have the system suggest your widget at someone’s wake up time or, let’s say you have a workout tracker app. If someone has not worked out yet for the day, you can use the .fitness relevant context with the .activityRingsIncomplete condition to have the system suggest your widget.
If your widget has an AppIntentConfiguration, you can give relevance per intent. Let’s take a look at an example from a Coffee Shop widget. Each intent represents someone’s favorited store location. You can provide a location-relevant context for each location when someone is close by that store. The initializer for WidgetRelevanceEntry will take in an additional configuration parameter for your app intent. And the relevances method’s return type will have your WidgetConfigurationIntent type as the generic parameter.
When someone changes their favorite coffee shop, use the invalidateRelevances method to provide updated relevant locations.
To summarize, Choose which relevant context you assign carefully, because it is important to suggest your widgets when they are useful and actionable. RelevantContext is used by the system to suggest your widget and to determine its priority among other widgets. The system considers suggestions from many widgets simultaneously so there’s no guarantee your widget will always appear. Next up is Interactive widgets.
In iOS 17 and macOS 14, we introduced interactive widgets, which allow people to perform actions right from a widget without having to open the app.
You can now bring your interactive widget to watchOS too! Just like in iOS and macOS, buttons and toggles will be available to make your watchOS widget interactive. The interactive Home widgets in watchOS 11 let people directly lock or unlock their door, for example.
Interactivity makes it possible to provide quick actions without launching your app. All watchOS widget families support interactivity! Multiple interactions are supported but may not make sense for some widget families due to their shape and size. Let’s look at how to bring interactivity to your widgets with an example from the Home widget.
First, create a SwiftUI Button inside the widget view.
Then, in your widget’s Intent, implement the perform() method to specify the app intent action. In this case, tapping on the button will lock the door.
For more details on how to use interactive widgets, be sure to check out the “Bring widgets to life” session about interactivity, where the same principles apply on watchOS as well.
Sometimes, it is important to add an extra step of confirmation when an action is about to be executed from a widget, to avoid any unwanted surprises. For example, when someone is at work, tapping a widget to unlock their door at home could be unintentional.
You can use the requestConfirmation() API to show an additional prompt before your intent is performed, to confirm that someone intended this action. Pass .lowConfidenceSource for the conditions parameter to let the system decide when accidental taps are possible, and to prompt in those cases.
To make creating an interactive watchOS widget as seamless and convenient as possible, we are introducing a view-template API called AccessoryWidgetGroup You can use this template to create a view in an accessoryRectangular widget that has up to three different pieces of content, allowing for more glanceability.
In watchOS 11, there are many new widgets using this layout.
The Messages widget shows your top three pinned contacts.
There are 2 main components in AccessoryWidgetGroup, Label and Content. By default, Label will have a display name of the app’s Widget Extension bundle. However, we encourage you to provide a custom Label or Text view. Content can have up to 3 views. If more than 3 views are provided, only the first 3 views provided will be shown. Each view in the content can be interactive or it can deep link to a different part of your app using Link. The font sizes, the content view size, and the content margins are all pre-configured, allowing you to focus on the content of the widget.
If there are fewer than three pinned contacts, the system will automatically insert extra empty views to ensure that three views appear in the widget. When tapped, empty views will simply launch the app. The system provides the color of the empty views. For visual consistency across all widgets, this color is not configurable.
You can use the .accessoryWidgetGroupStyle view modifier to specify the masking shape of the content views either .circular, or .roundedSquare. If unspecified, the default is .circular.
You can also customize the colors in your AccessoryWidgetGroup layout.
The background can be tinted using the .containerBackground() view modifier. The label can be tinted using the .foregroundStyle() view modifier.
Let’s summarize the new features in Widgets. Relevant widgets allow the system to suggest your widget to people at the right time. We have also talked about interactive widgets, where you can add multiple tap targets on a single widget, and execute actions without having to launch your app.
AccessoryWidgetGroup is a great way to display multiple kinds of content or app intents in a single widget. All of this comes together to make the Smart Stack even more actionable and intelligent.
Now, let’s talk about Double tap! Apple Watch Series 9 and Ultra 2 introduced a brand new way to perform common actions such as answering the phone, pausing music, and scrolling through Smart Stack with a Double tap gesture. In watchOS 11, double tap has been expanded to work in more places in your app.
Double tap will now scroll through Lists, ScrollViews, and vertical style TabViews. Your app will get this behavior automatically.
In addition to the automatic scrolling behavior, you can identify a primary action to perform with Double Tap. For example, activating a button or toggle in your app, or in your Widget or Live Activity in the Smart Stack.
Apply the .handGestureShortcut modifier to a button or toggle to identify it as the .primaryAction. When a person performs the Double tap gesture, the system will automatically highlight the outline of the Button or Toggle to provide a visual indication that this is the action that will be invoked. You can customize the shape of the highlight using the “clip shape” view modifier if needed.
Only one element at a time can be the primary action, so consider your app’s interface and use case carefully. Double tap will trigger your primary action only if the control is on screen. If the control is off screen, the system will scroll toward it. If your app already uses Lists or ScrollViews and thus inherits the automatic scrolling behavior with Double tap, do not use it to also execute an action within those views. Double tap is at its best when used consistently and predictably in your app.
Let’s wrap up with some of the enhancements in WorkoutKit and HealthKit.
WorkoutKit has a new activity type! Pool swimming joins cycling and running in the Custom Workouts API. And custom pool swimming has a new goal type as well. distanceWithTime allows a workout step to have both a distance goal and a time goal. For all custom workout types, you can now customize the name of your Work, Recovery, Warmup, and Cooldown steps with a new displayName property. Be sure to check out the "Build custom swimming workouts with WorkoutKit" session for more details.
In HealthKit, you can now read and write mood or emotion data using the new State of Mind API. Be sure to check out the “Explore wellbeing APIs in HealthKit” session for more details.
We’re very excited about these new opportunities for your apps in watchOS 11! Your Live Activities will now appear on Apple Watch, and you can customize the experience. Relevance, interactivity, and additional layout options can make your widgets more actionable and glanceable in the Smart Stack. Double Tap offers new ways to navigate and take action in your app or widget. And enhancements in HealthKit and WorkoutKit bring new possibilities for apps in the Health & Fitness space. For more on what’s new in SwiftUI, check out the “What’s new in SwiftUI” session! I cannot wait to see what innovations you will bring to your apps and widgets with these new APIs. Thank you for watching!
-
-
Looking for something specific? Enter a topic above and jump straight to the good stuff.
An error occurred when submitting your query. Please check your Internet connection and try again.