Skip to content

App Integrations ​

This guide consolidates the practical host-app patterns from DocC tutorials 03-display-post and 03-remote.

Post-workout flow integration ​

Use controller override points to synchronize backend save, custom UI transitions, and dismissal.

swift
override func displayPostWorkout() -> AnyPublisher<Void, Never> {
    guard let savePublisher else { return super.displayPostWorkout() }

    savePublisher
        .handleEvents(receiveCompletion: { [weak self] _ in
            self?.dismiss(animated: true)
        })
        .eraseToAnyPublisher()
}

This pattern prevents race conditions between data persistence and UI teardown.

Google Cast integration ​

Google Cast integration for Workout Video now has a dedicated step-by-step guide. Use Google Cast for Video Workouts for full setup details (SDK, Info.plist, AppDelegate, StreamingWorkoutController, and callback bridge).

Integration boundary ​

TrainingKit owns the workout UI state machine, while the host app remains responsible for backend API calls, authorization, analytics, and the Cast app lifecycle.

Source references ​