Skip to content

Delegates

This page documents callback contracts between WorkoutKit and host app code.

DocC symbol source is available at:

https://github.com/fysiki/workoutkit-ios-sdk/blob/main/documentation/FZWorkoutKit.doccarchive.zip

WorkoutKitInterface

WorkoutKitInterface is the core host lifecycle protocol implemented by WorkoutKit controllers.

MethodContract
saveSession(state: SaveWorkoutState)Persist session results in host backend/app logic. Call super in controller overrides.
displayPostWorkout() -> AnyPublisher<Void, Never>Return publisher that completes when post-workout flow is done.
quitWorkout()Handle quit-without-save flow. Call super and ensure handling of non-UI-thread invocations.

GoModeController and GoVideoController both provide default implementations for this protocol.

WorkoutKitLogInterface

WorkoutKitLogInterface provides host-level logging and tracking hooks.

MethodContract
log(_ message: String, context: [String: AnyHashable]?)Receives debug log messages and optional metadata context.
trackEvent(_ event: Tracking.Event, properties: [Tracking.Property: String]?)Receives structured analytics events emitted by WorkoutKit.

WorkoutKitRegularInterface

This protocol covers business callbacks specific to regular workouts.

MethodContract
getAllRecommendations() -> AnyPublisher<Data, Never>Called when recommendations must be fetched by host logic.
buyPremiumContent(from: UIViewController?) -> AnyPublisher<Data, Never>Called when premium content purchase flow is requested.

RemoteManagerDelegate

RemoteManagerDelegate defines callbacks from remote media clients toward the workout controller.

High-signal callbacks include:

  • remoteSessionDidStart()
  • remoteSessionDidEnd(at:)
  • remoteSessionDidResume()
  • remoteSessionCanStartMedia()
  • remoteSessionCanResumeMedia(at:)
  • remoteSessionDidUpdateMediaStatus(time:hasMedia:state:)
  • remoteSessionDidUpdateMetadata(coverUrl:)
  • remoteSessionOtherMediaPlaying()
  • remoteDidTapQuitWorkout()