2026-07-03 23:57:49 +02:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
/// A service that transcribes recorded audio into text for the Recording feature.
|
|
|
|
|
///
|
|
|
|
|
/// ``RecordingView`` attaches the service to its model at initialization, so the transcription can be swapped without touching the feature's
|
|
|
|
|
/// state machine — for example, with a real transcription backend in the app, or with a fast mock in unit tests.
|
2026-07-04 12:03:19 +02:00
|
|
|
public protocol Transcribing: Sendable {
|
2026-07-03 23:57:49 +02:00
|
|
|
|
2026-07-04 12:03:19 +02:00
|
|
|
// MARK: Methods
|
|
|
|
|
|
2026-07-04 15:06:55 +02:00
|
|
|
/// Transcribes the given recorded audio file into text, letting the service be called directly as a function.
|
2026-07-03 23:57:49 +02:00
|
|
|
///
|
2026-07-04 12:03:19 +02:00
|
|
|
/// - Parameters:
|
2026-07-04 15:06:55 +02:00
|
|
|
/// - audio: The location of the recorded audio file to transcribe.
|
2026-07-04 12:03:19 +02:00
|
|
|
/// - locale: The locale of the spoken language to transcribe.
|
2026-07-03 23:57:49 +02:00
|
|
|
/// - Returns: The transcription of the recorded audio.
|
2026-07-04 12:03:19 +02:00
|
|
|
func callAsFunction(
|
2026-07-04 15:06:55 +02:00
|
|
|
_ audio: URL,
|
2026-07-04 12:03:19 +02:00
|
|
|
locale: Locale
|
|
|
|
|
) async throws -> Transcription
|
2026-07-03 23:57:49 +02:00
|
|
|
|
|
|
|
|
}
|