Enable native Apple Speech Analyzer in build
This commit is contained in:
parent
d62ffbc630
commit
0b8eb71048
@ -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;
|
||||
};
|
||||
|
||||
@ -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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user