From 0b8eb71048fdf26e978c46fc320367ddb2e1afbf Mon Sep 17 00:00:00 2001 From: Beingpax Date: Mon, 11 Aug 2025 09:07:29 +0545 Subject: [PATCH] Enable native Apple Speech Analyzer in build --- VoiceInk.xcodeproj/project.pbxproj | 5 ++++- VoiceInk/Services/NativeAppleTranscriptionService.swift | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/VoiceInk.xcodeproj/project.pbxproj b/VoiceInk.xcodeproj/project.pbxproj index 7c85b52..dc140f2 100644 --- a/VoiceInk.xcodeproj/project.pbxproj +++ b/VoiceInk.xcodeproj/project.pbxproj @@ -388,7 +388,7 @@ MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG ENABLE_NATIVE_SPEECH_ANALYZER $(inherited)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -445,6 +445,7 @@ MTL_FAST_MATH = YES; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "ENABLE_NATIVE_SPEECH_ANALYZER $(inherited)"; }; name = Release; }; @@ -478,6 +479,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG ENABLE_NATIVE_SPEECH_ANALYZER $(inherited)"; }; name = Debug; }; @@ -511,6 +513,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "ENABLE_NATIVE_SPEECH_ANALYZER $(inherited)"; }; name = Release; }; diff --git a/VoiceInk/Services/NativeAppleTranscriptionService.swift b/VoiceInk/Services/NativeAppleTranscriptionService.swift index e7009da..c2b9fd5 100644 --- a/VoiceInk/Services/NativeAppleTranscriptionService.swift +++ b/VoiceInk/Services/NativeAppleTranscriptionService.swift @@ -176,7 +176,7 @@ class NativeAppleTranscriptionService: TranscriptionService { // Forward-compatibility: Use Any here because SpeechTranscriber is only available in future macOS SDKs. // This avoids referencing an unavailable SDK symbol while keeping the method shape for later adoption. @available(macOS 26, *) - private func ensureModelIsAvailable(for transcriber: Any, locale: Locale) async throws { + private func ensureModelIsAvailable(for transcriber: SpeechTranscriber, locale: Locale) async throws { #if canImport(Speech) && ENABLE_NATIVE_SPEECH_ANALYZER let installedLocales = await SpeechTranscriber.installedLocales let isInstalled = installedLocales.map({ $0.identifier(.bcp47) }).contains(locale.identifier(.bcp47))