Added a toolbar locale picker to the ContentView view in the Sample app target.

This commit is contained in:
2026-07-04 12:59:24 +02:00
parent 20cbda7b27
commit 0d0705c95a
3 changed files with 91 additions and 8 deletions
+31 -2
View File
@@ -17,8 +17,9 @@ struct ContentView: View {
// MARK: Body
/// The content of the view: a navigation stack with the recording feature's view, attached to the model's services, and a modal sheet
/// presenting the transcribed text of every processed recording, closable through its toolbar button or a swipe.
/// The content of the view: a navigation stack with the recording feature's view, attached to the model's services, with a toolbar picker
/// for the locale of the spoken language to transcribe, and a modal sheet presenting the transcribed text of every processed recording,
/// closable through its toolbar button or a swipe.
var body: some View {
NavigationStack {
RecordingView(
@@ -32,6 +33,34 @@ struct ContentView: View {
#if !os(macOS)
.navigationBarTitleDisplayMode(.inline)
#endif
.toolbar {
ToolbarItem(placement: .primaryAction) {
Menu {
Picker(
"view.recording.picker.locale.title",
selection: $model.locale
) {
ForEach(
model.locales,
id: \.self
) {
Text(model.name(for: $0))
.tag($0)
}
}
.pickerStyle(.inline)
} label: {
Label(
"view.recording.picker.locale.title",
systemImage: "globe"
)
}
.disabled(model.locales.isEmpty)
}
}
.task {
await model.load()
}
}
.sheet(item: $model.transcription) { transcription in
NavigationStack {