]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama.swiftui : add "Done" dismiss button to help view (#11998)
authorDaniel Bevenius <redacted>
Sat, 22 Feb 2025 05:33:29 +0000 (06:33 +0100)
committerGitHub <redacted>
Sat, 22 Feb 2025 05:33:29 +0000 (06:33 +0100)
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.

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

index 30c2dc4310210adf99ec7a773ad0a5e82cda1641..1c3cd9d2efc7387103bec4458ba7463e7a21c51f 100644 (file)
@@ -124,15 +124,26 @@ struct ContentView: View {
                     }
                 }
             }.sheet(isPresented: $showingHelp) {    // Sheet for help modal
-                VStack(alignment: .leading) {
+                NavigationView {
                     VStack(alignment: .leading) {
-                        Text("1. Make sure the model is in GGUF Format")
-                               .padding()
-                        Text("2. Copy the download link of the quantized model")
-                               .padding()
+                        VStack(alignment: .leading) {
+                            Text("1. Make sure the model is in GGUF Format")
+                                    .padding()
+                            Text("2. Copy the download link of the quantized model")
+                                    .padding()
+                        }
+                        Spacer()
+                    }
+                    .navigationTitle("Help")
+                    .navigationBarTitleDisplayMode(.inline)
+                    .toolbar {
+                        ToolbarItem(placement: .navigationBarTrailing) {
+                            Button("Done") {
+                                showingHelp = false
+                            }
+                        }
                     }
-                    Spacer()
-                   }
+                }
             }
         }
     }