import Foundation /// The transcribing service used for development, which simulates the transcription work. /// /// The service is internal on purpose: it only backs the feature's previews and the default values of its model, and is not part of the /// package's public interface. struct DummyTranscribingService: TranscribingService { // MARK: Methods /// Simulates the transcription of the given recorded audio with a two-second delay. /// /// - Parameter audio: The recorded audio to transcribe. /// - Returns: A dummy transcription. func transcribe( _ audio: Data ) async throws -> String { try await Task.sleep(for: Constant.Delay.transcribing) return Constant.Text.transcription } } // MARK: - Constants /// The constant values used across the transcribing services. private enum Constant { /// The delay constants. enum Delay { /// The duration of the simulated transcription work. static let transcribing: Duration = .seconds(2) } /// The text constants. enum Text { /// The dummy transcription of a recorded audio. static let transcription = "This is a dummy transcription of the recorded audio." } }