Workout validation and Scheduler logic

Hey folks, a couple of questions regarding WorkoutKit:

  1. What happened to validation errors? They are mentioned in the WWDC23 video, but no longer are present in the API. It seems a fatal error is thrown if the workout fails validation (for example setting a negative distance in a workout goal).

  2. What is the logic of the WorkoutScheduler, if we try to add more workouts than is allowed? If the limit is 50, what happens when we try to add a 51st? Are workouts de-queued based on date or anything? API documentation is very sparse

  3. Do completed workouts and workouts with a scheduled date in the past stay in the WorkoutScheduler? Are we responsible for removing these? I guess my overall question regarding the WorkoutScheduler is, what are we responsible for managing and what is handled gracefully for us.

None of these answers seem to be openly available, but if anyone know anecdotally or even better from the WorkoutKit team, I'd be very grateful!

Thanks!

I had the same questions as you when developing an app that uses WorkoutKit. It is indeed a shame that the documentation is really sparse and that the WWDC23 videos are more of less obsolete because the APIs changed so much.

Anyway, here's what I found:

  1. No idea about that. I just do/try/catch.
  2. I did the test a while ago on iOS 17 and I noticed that if you go past 50 workouts, it "wipes" the existing ones and start from scratch. No queue logic. I didn't try with iOS 18 though, so hopefully it was improved...
  3. Would really like to know about that as well. I did notice though that past scheduled workouts do not count in the 50 workouts limit.

Would be nice to have official documentation on those above points. Let me know if you discover anything else!

Workout validation and Scheduler logic
 
 
Q