Made the transcribing callable and per-call for the transcribing protocol in the Recording package target.

This commit is contained in:
2026-07-04 12:03:19 +02:00
parent 8b46c4e7d1
commit 68c070948e
9 changed files with 60 additions and 57 deletions
@@ -0,0 +1,22 @@
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.
public protocol Transcribing: Sendable {
// MARK: Methods
/// Transcribes the given recorded audio into text, letting the service be called directly as a function.
///
/// - Parameters:
/// - audio: The recorded audio to transcribe.
/// - locale: The locale of the spoken language to transcribe.
/// - Returns: The transcription of the recorded audio.
func callAsFunction(
_ audio: Data,
locale: Locale
) async throws -> Transcription
}