diff --git a/VoiceInk/Services/NativeAppleTranscriptionService.swift b/VoiceInk/Services/NativeAppleTranscriptionService.swift index 2ed95bc..06754ca 100644 --- a/VoiceInk/Services/NativeAppleTranscriptionService.swift +++ b/VoiceInk/Services/NativeAppleTranscriptionService.swift @@ -62,7 +62,7 @@ class NativeAppleTranscriptionService: TranscriptionService { throw ServiceError.unsupportedOS } - #if canImport(Speech) + #if canImport(Speech) && compiler(>=6.0) && swift(>=6.0) logger.notice("Starting Apple native transcription with SpeechAnalyzer.") let audioFile = try AVAudioFile(forReading: audioURL) @@ -143,11 +143,12 @@ class NativeAppleTranscriptionService: TranscriptionService { return finalTranscription #else - logger.error("Speech framework is not available") + logger.error("SpeechTranscriber is not available in this compiler version or Speech framework is not available") throw ServiceError.unsupportedOS #endif } + #if compiler(>=6.0) && swift(>=6.0) @available(macOS 26, *) private func deallocateExistingAssets() async throws { #if canImport(Speech) @@ -158,7 +159,9 @@ class NativeAppleTranscriptionService: TranscriptionService { logger.notice("Deallocated existing asset locales.") #endif } + #endif + #if compiler(>=6.0) && swift(>=6.0) @available(macOS 26, *) private func allocateAssetsForLocale(_ locale: Locale) async throws { #if canImport(Speech) @@ -171,7 +174,9 @@ class NativeAppleTranscriptionService: TranscriptionService { } #endif } + #endif + #if compiler(>=6.0) && swift(>=6.0) @available(macOS 26, *) private func ensureModelIsAvailable(for transcriber: SpeechTranscriber, locale: Locale) async throws { #if canImport(Speech) @@ -191,4 +196,5 @@ class NativeAppleTranscriptionService: TranscriptionService { } #endif } + #endif }