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
+1 -30
View File
@@ -12,7 +12,7 @@ import SwiftUI
///
/// The services attached to the feature, the transcription shown in the sheet, and the notifier owning the notifications live in the view's
/// ``Model``; the view itself only renders it and forwards the feature's output, the picker's changes, and the sheet's dismissal. All
/// user-facing text is localized through the app's string catalog.
/// user-facing text is localized through the app's string catalog, resolved via its generated string symbols.
struct ContentView: View {
// MARK: Properties
@@ -220,35 +220,6 @@ private enum Constant {
// MARK: - Previews
/// The preinstalling service used by the previews, which resolves every locale as supported and downloads nothing.
private struct PreviewPreinstalling: Preinstalling {
/// The stream of events the service emits, which finishes immediately.
let events: AsyncStream<PreinstallingEvent> = .init { continuation in
continuation.finish()
}
func preinstall(
for locale: Locale
) async {
// The previews preinstall no speech model assets.
}
func supportedLocale(
equivalentTo locale: Locale
) async -> Locale? {
locale
}
func supportedLocales() async -> [Locale] {
[
Locale(identifier: "en-US"),
Locale(identifier: "nl-NL"),
]
}
}
#Preview(
"Content view"
) {