Streaming is available in most browsers,
and in the Developer app.
-
Build custom swimming workouts with WorkoutKit
Check out the latest in creating, customizing, and scheduling workouts using WorkoutKit. Sprint through the latest in pace and power alerts and expanded support for distance goals. And keep the momentum going with the benefits of custom step names.
Chapters
- 0:00 - Introduction
- 1:25 - User-selectable workout locations
- 3:13 - Custom step names
- 4:20 - Custom pool swimming workouts
Resources
Related Videos
WWDC23
-
Download
Hi! I’m Srinidhi, an engineer on the Workout team, and welcome to “Build custom swimming workouts with WorkoutKit." WorkoutKit lets you create different types of workouts and sync them directly from your apps to the Workout app on Apple Watch.
You can build goal based workouts where users can perform a workout with a singular goal for energy, time, or distance.
Pacer workouts - that puts the focus on pace front and center.
Swim bike run workouts - for triathletes to seamlessly transition between swim, bike, and run activities. And custom workouts - which have structured steps with a combination of custom goals and alerts. Let me quickly recap the structure of a custom workout.
They’re composed of workout steps that conform to either warmup, work, recovery, or cool down types. Work and recovery steps are grouped together in repeatable interval blocks. If you want to go deeper on the structure of a custom workout, check out last year’s session “Build Custom Workouts with WorkoutKit”.
We’ve gathered a lot of great feedback from users and developers this past year, and would like to share some exciting new enhancements that can help your app provide a comprehensive workout experience. First up, user-selectable workout locations. Starting in watchOS 10.1, you no longer need to specify between indoor and outdoor location types when scheduling workouts. For example, you can simply schedule a cycling workout, leaving the user to decide if they want to do this workout outdoors or maybe indoors if it’s raining.
In addition, WorkoutKit is introducing a variety of improvements to different activity types, starting with average power alerts for running and cycling workouts. Starting in watchOS 10.4, you can specify between current and average power alerts for both range and threshold alerts.
And, new for indoor running, watchOS 11 now supports pace alerts. These new alerts pair nicely with a refreshed visual target view available for all custom workouts. Now, you’ll always know if you’re within range of your target just by raising your wrist. In addition to new alert types, WorkoutKit is increasing support for distance goals.
Up till now, workoutKit has supported distance in a collection of workout activities. But in watchOS 11, this list is expanding to include many more outdoor activity types, and even includes some brand new activity types such as outdoor rowing and outdoor skating.
Distance goals are now supported for any of these outdoor workout types. To check if a goal is supported for a workout activity and location pairing, be sure to use the supports goal function that’s available for single goal workouts, and for custom workouts.
So those are the updates for running, cycling, and more outdoor workouts. But what about activities like strength training, or hiit workouts? In watchOS 11, WorkoutKit is introducing the ability to customize step names for all workout types. This is a great way to provide more context for a step by including things like types of exercises, weights or reps, or perceived effort levels. When a step name isn’t specified, the step will default to show the step type. You can set a custom step name by using the new displayName property on WorkoutStep.
Here, I’ll customize my warmupStep to say “Walk”, and set my workStep to “Sprint”.
Step names are displayed throughout the custom workout experience. Like between steps where the users will be notified about the upcoming step with a full screen alert and during the workout with the brand new view you can reach simply by scrolling down. This view shows you more details about your current step as well a preview for your upcoming step. And finally, what I’m most excited about for WorkoutKit in watchOS 11 are the new updates to pool swimming. WorkoutKit is making a big splash with custom pool swimming workouts.
All the API that exists today for custom workouts like creating steps, goals, and alerts, are now coming to pool swimming. And just for custom pool swim workouts, WorkoutKit is introducing a brand new goal type that combines both distance with time.
Swimmers often perform repeated sets of distance and rest where they aim to complete a certain number of laps in a specified time. Distance with time goals are a great way to cater to this training style.
It’s a goal type that let’s you specify both the distance goal and the time goal for a single workout step.
The workout only advances to the next step once both goals have been achieved.
To create this goal, you can use the new poolSwimDistanceWithTime goal type, and pass in a Measurement for the distance length and time duration. Now, I’ll test the waters by showing you a simple example on how to use the new API to build a custom pool swimming workout. Diving right in, I’ll start by creating a distance with time goal. I want to complete two 25 m laps in 1 minute, so I’ll create a distance of 50 m and a time duration of 1 min.
I’ll combine the two values using the poolSwimDistanceWithTime goal type to create my WorkoutGoal. Now I’ll apply the goal to a workStep.
And I’ll use the displayName property to customize the step to indicate what swim stroke the user should do. Next, I’ll add the step to an intervalBlock with 6 repeats. Now my distance with time goal is complete, but let’s keep going with the flow and build out the rest of my workout. Keeping my 25 m lap length in mind, I’ll create a warmupStep of 8 laps of kickboarding and a cooldownStep of 8 laps of free swim. Now I’m ready to put everything together.
To create a custom pool swimming workout, I’ll specify the activity as swimming, add a displayName, and pool all of my steps together. Lastly, I’ll use the WorkoutScheduler API to schedule my workout for later this afternoon.
Now that our workout is ready, let’s dive in and take a look at what a custom swimming workout looks like inside the Workout app. When I start this workout, the Workout App prompts for pool length to get the most accurate lap distance measurements. You may recall that I created this workout earlier with a pool length of 25 m in mind, but the pool I’m at is 25 yd long.
Since my pool length doesn’t map to the intervals in the workout, the Workout app will convert the distances and scale the time just for this swim. This way, I’m still doing the workout that was intended, but catered to the pool I’m in.
Now I can start the workout knowing that the steps won’t end in the middle of the pool.
During a custom pool swim workout, you’ll see a brand new view with the repeats indicator in the top-left corner and water temperature that’s available on the Apple Watch Ultra starting in watchOS 11. During a distance with time goal, distance and interval time are displayed at the bottom. When the distance goal is achieved first, a checkmark will indicate that we’re waiting for the time goal to complete before advancing to the next step. And that’s everything that’s new with WorkoutKit! So whether your app is helping users be more active and in tune with their workouts or reach new heights for their cycling adventures or achieving a new personal best, WorkoutKit is a great way to deliver your workouts to the workout app. And, using these new enhancements you can do even more to customize your workouts! I’m looking forward to seeing what you do with WorkoutKit.
To wrap-up, I encourage you to try out the API by adopting new alerts, goal types, and step names. If your app caters to swimmers, try building and scheduling custom swimming workouts.
Be sure to checkout the updated sample code to see another example of how to build and schedule a custom swimming workout.
Send us feedback through the feedback assistant. We’d love to hear from you! Lastly, check out these other sessions to learn more about what’s new in Health.
Well, it’s almost time for my swim, so I’m getting ready to head over to the pool. Thanks 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.