From a6ba4e2bb073740dacb011fa43b4f27cf55b7e54 Mon Sep 17 00:00:00 2001 From: isaiah Date: Mon, 8 Jan 2024 16:55:55 -0700 Subject: [PATCH] trimmed trailing white space --- .../llama.swiftui/Models/LlamaState.swift | 10 +++++----- .../llama.swiftui/llama.swiftui/UI/ContentView.swift | 8 ++++---- .../llama.swiftui/UI/DownloadButton.swift | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift b/examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift index 14ba627c8..5bde18917 100644 --- a/examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift +++ b/examples/llama.swiftui/llama.swiftui/Models/LlamaState.swift @@ -26,7 +26,7 @@ class LlamaState: ObservableObject { loadModelsFromDisk() loadDefaultModels() } - + private func loadModelsFromDisk() { do { let documentsURL = getDocumentsDirectory() @@ -46,11 +46,11 @@ class LlamaState: ObservableObject { } catch { messageLog += "Error!\n" } - + for model in defaultModels { let fileURL = getDocumentsDirectory().appendingPathComponent(model.filename) if FileManager.default.fileExists(atPath: fileURL.path) { - + } else { var undownloadedModel = model undownloadedModel.status = "download" @@ -112,8 +112,8 @@ class LlamaState: ObservableObject { messageLog += "Load a model from the list below\n" } } - - + + private func updateDownloadedModels(modelName: String, status: String) { undownloadedModels.removeAll { $0.name == modelName } } diff --git a/examples/llama.swiftui/llama.swiftui/UI/ContentView.swift b/examples/llama.swiftui/llama.swiftui/UI/ContentView.swift index d2cc6acd3..30c2dc431 100644 --- a/examples/llama.swiftui/llama.swiftui/UI/ContentView.swift +++ b/examples/llama.swiftui/llama.swiftui/UI/ContentView.swift @@ -51,7 +51,7 @@ struct ContentView: View { } .padding() .navigationBarTitle("Model Settings", displayMode: .inline) - + } } @@ -74,7 +74,7 @@ struct ContentView: View { } } struct DrawerView: View { - + @ObservedObject var llamaState: LlamaState @State private var showingHelp = false func delete(at offsets: IndexSet) { @@ -87,7 +87,7 @@ struct ContentView: View { print("Error deleting file: \(error)") } } - + // Remove models from downloadedModels array llamaState.downloadedModels.remove(atOffsets: offsets) } @@ -114,7 +114,7 @@ struct ContentView: View { DownloadButton(llamaState: llamaState, modelName: model.name, modelUrl: model.url, filename: model.filename) } } - + } .listStyle(GroupedListStyle()) .navigationBarTitle("Model Settings", displayMode: .inline).toolbar { diff --git a/examples/llama.swiftui/llama.swiftui/UI/DownloadButton.swift b/examples/llama.swiftui/llama.swiftui/UI/DownloadButton.swift index a13d22505..4584d6eaa 100644 --- a/examples/llama.swiftui/llama.swiftui/UI/DownloadButton.swift +++ b/examples/llama.swiftui/llama.swiftui/UI/DownloadButton.swift @@ -52,7 +52,7 @@ struct DownloadButton: View { print("Writing to \(filename) completed") llamaState.cacheCleared = false - + let model = Model(name: modelName, url: modelUrl, filename: filename, status: "downloaded") llamaState.downloadedModels.append(model) status = "downloaded"