Issue with workoutPreview API - Workouts Not Sending to Apple Watch

Hi everyone,

I’m reaching out to see if anyone else has experienced issues with the workoutPreview API. I’ve been trying to get it to send workouts to the Apple Watch, but it’s not working as expected. Even the example code provided in the official documentation fails to do the job.

For reference, I’m using the latest stable (non-beta) versions of iOS and watchOS.

import SwiftUI
import WorkoutKit

struct PresentPreviewDemo: View {
    private let cyclingWorkoutPlan: WorkoutPlan
    @State var showPreview: Bool = false
    
    init() {
        cyclingWorkoutPlan = WorkoutPlan(.custom(WorkoutStore.createCyclingCustomWorkout()))
    }
    
    var body: some View {
        Button("Present Cycling Workout Preview") {
            showPreview.toggle()
        }
        .workoutPreview(cyclingWorkoutPlan, isPresented: $showPreview)
    }
}

struct PresentPreviewDemo_Previews: PreviewProvider {
    static var previews: some View {
        PresentPreviewDemo()
    }
}

It used to work but it is not working anymore.

Has anyone else run into this problem? Is there a known issue or workaround that I might have missed? I’ve tried everything I can think of, and this is blocking my progress.

Any insights or suggestions would be greatly appreciated!

Thanks in advance!

I tried the Customizing workouts with WorkoutKit sample with the Xcode 16.0 beta 6 (16A5230g), the latest public beta we currently have, and see that the workout preview works in my simulator (iOS 18 beta). Would you mind to give it a try? If the problem goes away, it might be an issue that has been fixed.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Even in production apps on the App Store, the workoutPreview feature is not working with the latest iOS version (iOS 17.6.1, watchOS 10.6.1). It works on previous versions and on the iOS 18 beta. Something looks broken with iOS 17.6.1.

Issue with workoutPreview API - Workouts Not Sending to Apple Watch
 
 
Q