Skip to content

Commit de8b5a3

Browse files
authored
llama.swiftui : add "Done" dismiss button to help view (#11998)
The commit updates the help view in the llama.swiftui example to use a NavigationView and a Done button to dismiss the help view. The motivation for this is that without this change there is now way to dimiss the help view.
1 parent 51f311e commit de8b5a3

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

examples/llama.swiftui/llama.swiftui/UI/ContentView.swift

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,26 @@ struct ContentView: View {
124124
}
125125
}
126126
}.sheet(isPresented: $showingHelp) { // Sheet for help modal
127-
VStack(alignment: .leading) {
127+
NavigationView {
128128
VStack(alignment: .leading) {
129-
Text("1. Make sure the model is in GGUF Format")
130-
.padding()
131-
Text("2. Copy the download link of the quantized model")
132-
.padding()
129+
VStack(alignment: .leading) {
130+
Text("1. Make sure the model is in GGUF Format")
131+
.padding()
132+
Text("2. Copy the download link of the quantized model")
133+
.padding()
134+
}
135+
Spacer()
136+
}
137+
.navigationTitle("Help")
138+
.navigationBarTitleDisplayMode(.inline)
139+
.toolbar {
140+
ToolbarItem(placement: .navigationBarTrailing) {
141+
Button("Done") {
142+
showingHelp = false
143+
}
144+
}
133145
}
134-
Spacer()
135-
}
146+
}
136147
}
137148
}
138149
}

0 commit comments

Comments
 (0)