Appearance
Controllers
This page documents the primary iOS controller APIs exposed by TrainingKit.
DocC symbol source is available at:
ClassicWorkoutController (classic workouts)
ClassicWorkoutController is the UIKit entry point for classic workouts.
If you see SampleClassicWorkoutController in the sample app, treat it as an example host subclass of ClassicWorkoutController, not as part of the public SDK naming.
Initializer:
swift
init(data: Data, token: String? = nil, configuration: [String: Any]? = nil)High-signal methods:
| Method | Description |
|---|---|
saveSession(state:) | Triggered when TrainingKit requires session persistence within the host app. |
displayPostWorkout() -> AnyPublisher<Void, Never> | Called after normal workout completion (not quit). |
quitWorkout() | Called when workout is exited without save. |
trackEvent(_:properties:) | Tracking callback for host analytics integration. |
log(_:context:) | Debug/log callback with optional metadata context. |
shouldDisplayCloseButton() | UI behavior customization hook. |
StreamingWorkoutController (video workouts)
StreamingWorkoutController is the UIKit entry point for streaming workouts and remote-media integrations.
If you see SampleStreamingWorkoutController in the sample app, treat it as an example host subclass of StreamingWorkoutController, not as part of the public SDK naming.
Common initializer variant:
swift
init(data: Data, localStream: Bool = false, token: String? = nil, configuration: [String: Any]? = nil)High-signal properties:
| Property | Description |
|---|---|
video | Current video model used by the controller. |
metadata | Video metadata used for timeline/cover/title operations. |
remoteManager | Remote media bridge (cast/remote playback integration). |
leftItems | Left-side UI action items in video controller chrome. |
High-signal methods:
| Method | Description |
|---|---|
saveSession(state:) | Same persistence callback model as classic controller. |
displayPostWorkout() -> AnyPublisher<Void, Never> | Post-workout completion callback. |
quitWorkout() | Quit callback for non-saved exits. |
trackEvent(_:properties:) | Tracking callback for host analytics integration. |
log(_:context:) | Debug/log callback with optional metadata context. |
The video controller also includes default implementations for RemoteManagerDelegate and picture-in-picture delegate behaviors.
Other controller symbols in DocC
The archive also exposes ExerciseController and ExerciseVideoController, used for exercise-level UI surfaces around media and detailed exercise content.
Host override guidance
In host subclasses, keep overrides focused on business integration and always call super for lifecycle callbacks such as saveSession(state:) and quitWorkout().
