Extracted the PreviewPreinstalling service in the Sample app target into its own file and declared it as development asset.

This commit is contained in:
2026-07-05 16:29:28 +02:00
parent 83ac1cf4e4
commit f1e4b59809
6 changed files with 68 additions and 33 deletions
@@ -0,0 +1,41 @@
import Foundation
import Recording
/// The preinstalling service used by the previews, which resolves every locale as supported and downloads nothing.
struct PreviewPreinstalling: Preinstalling {
/// The stream of events the service emits, which finishes immediately.
let events: AsyncStream<PreinstallingEvent> = .init { continuation in
continuation.finish()
}
/// Simulates the preinstallation of the speech model assets of the given locale, downloading nothing.
///
/// - Parameter locale: The locale to preinstall the speech model assets for.
func preinstall(
for locale: Locale
) async {
// The previews preinstall no speech model assets.
}
/// Returns the given locale as its own supported equivalent.
///
/// - Parameter locale: The locale to find a supported equivalent for.
/// - Returns: The given locale, unchanged.
func supportedLocale(
equivalentTo locale: Locale
) async -> Locale? {
locale
}
/// Returns a sample of supported locales for the locale picker.
///
/// - Returns: A pair of sample locales.
func supportedLocales() async -> [Locale] {
[
Locale(identifier: "en-US"),
Locale(identifier: "nl-NL"),
]
}
}