Implemented an unavailable view for empty transcriptions on the ContentView view in the Sample app target.

This commit is contained in:
2026-07-04 13:23:42 +02:00
parent 0d0705c95a
commit 3c542ee033
4 changed files with 43 additions and 13 deletions
+21 -11
View File
@@ -18,8 +18,8 @@ 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, 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.
/// for the locale of the spoken language to transcribe, and a modal sheet presenting the transcribed text of every processed recording
/// or a content unavailable message when the transcription is empty closable through its toolbar button or a swipe.
var body: some View {
NavigationStack {
RecordingView(
@@ -64,16 +64,26 @@ struct ContentView: View {
}
.sheet(item: $model.transcription) { transcription in
NavigationStack {
ScrollView {
Text(transcription.text)
.font(.body)
.fontWeight(.regular)
.foregroundStyle(.primary)
.frame(
maxWidth: .infinity,
alignment: .leading
Group {
if transcription.isEmpty {
ContentUnavailableView(
"view.transcription.unavailable.title",
systemImage: "text.page.slash",
description: Text("view.transcription.unavailable.description")
)
.padding()
} else {
ScrollView {
Text(transcription.text)
.font(.body)
.fontWeight(.regular)
.foregroundStyle(.primary)
.frame(
maxWidth: .infinity,
alignment: .leading
)
.padding()
}
}
}
.navigationTitle("view.transcription.navigation.title")
#if !os(macOS)