Custom Workout
Configure custom workout sequences. Applies to: Custom Workout only (createCustomWorkoutView, IntegrationOption.CUSTOM_WORKOUT, route /custom-workout): every other integration option ignores these. For the complete guide, see Custom Workout integration.
| Parameter | Type | Default | Applies to | What it does internally |
| customWorkoutExercises | array | required | Custom Workout | The exercise sequence. After verification the SDK fetches each exercise, then downloads videos, models and audio, and posts all_resources_loaded when everything is ready. An invalid item posts error_occurred (critical). The SDKs send it from the custom workout view's exercise list |
| showCommitScreen | boolean | false | Custom Workout | Adds an "I'm committed" button to the custom workout's loading screen. The tap lets iOS enable motion sensors and sound without a separate permission prompt, and posts workout_committed (data.orientation_permission). Send start after it. Accepts true or "true" |
| isAssessment | boolean | false | Custom Workout | Runs the custom workout as a fitness assessment: it ends on the assessment results screen instead of the completion overlay, and posts custom_assessment_completed there (workout score, activity level and a result per exercise). Accepts true or "true" |
Sequence object structure (per exercise):
| Property | Type | Required | Description |
| exerciseId | string | Yes | Exercise document ID (from the Content API) |
| reps | number or null | One of reps/duration | Target repetitions (rep-based exercise) |
| duration | number or null | One of reps/duration | Duration in seconds (timer-based exercise) |
| includeRestPeriod | boolean | Yes | Insert a rest screen before this exercise |
| restDuration | number | Yes | Rest length in seconds (a rest is only inserted when it is above 0) |
| stage | "warmup", "exercise" or "cooldown" | No | Colors the rest-screen progress bar by workout stage |
Custom Workout Flow:
1. Launch with the exercise list (customWorkoutExercises). The loading screen posts commit_screen_shown when it appears.
2. Wait for all_resources_loaded (error_occurred is posted if the sequence is invalid or a download fails).
3. With showCommitScreen: true, also wait for workout_committed (the user tapped "I'm committed").
4. Send { workout_activity_action: "start" }. The workout does not start until you do (Workout Activity Actions).
Note: restSpeeches / currentRestSpeech are Camera component parameters (Camera Component); custom workouts play their own rest audio, and keep the rest lengths you set (plus 3 s on the first rest when KinesteX plays its greeting). To simulate the workout with a video instead of the live camera, see Testing & Simulation.
1@State private var workoutAction: [String: Any]? = nil
2
3let customExercises = [
4 WorkoutSequenceExercise(
5 exerciseId: "exercise-id-1",
6 reps: 15,
7 includeRestPeriod: true,
8 restDuration: 20
9 )
10]
11
12kinestex.createCustomWorkoutView(
13 exercises: customExercises,
14 user: nil,
15 style: nil,
16 isLoading: $isLoading,
17 workoutAction: $workoutAction,
18 customParams: [
19 "isAssessment": false, // true: end on assessment results
20 "shouldSendStats": true // optional: save the session on completion
21 ],
22 onMessageReceived: { message in
23 // all_resources_loaded arrives as .custom_type: then start the workout
24 // workoutAction = ["workout_activity_action": "start"]
25 }
26)