diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2024-10-22 23:22:25 -0600 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2024-10-22 23:22:25 -0600 |
commit | 6df95ba6282a4d0864a10cdee7f00f8cde061135 (patch) | |
tree | 4daad0ccd056e949c122c06ceb4c9e190d7ba38c /iTexSnip/Views/MenuBarView.swift | |
parent | d5a52a1f01e9b1af5e3ea1dfd7d45865c97c9ade (diff) |
swift-format
Diffstat (limited to 'iTexSnip/Views/MenuBarView.swift')
-rw-r--r-- | iTexSnip/Views/MenuBarView.swift | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/iTexSnip/Views/MenuBarView.swift b/iTexSnip/Views/MenuBarView.swift index 4face4d..ba27840 100644 --- a/iTexSnip/Views/MenuBarView.swift +++ b/iTexSnip/Views/MenuBarView.swift @@ -38,7 +38,7 @@ struct MenuBarView: View { @Environment(\.modelContext) var modelContext @State var model: TexTellerModel? @Query(sort: \ImageSnippet.dateModifed, order: .reverse) var snippets: [ImageSnippet] - @AppStorage("loadModelOnStart") var loadModelOnStart: Bool = true + @AppStorage("loadModelOnStart") var loadModelOnStart: Bool = true let columns = [ GridItem(.flexible(), spacing: 16), @@ -100,17 +100,17 @@ struct MenuBarView: View { Spacer() }.task { - if loadModelOnStart { - do { - if self.model == nil { - let mymodel = try await TexTellerModel.asyncInit() - self.model = mymodel - print("Loaded da model") - } - } catch { - print("Failed to load da model: \(error)") - } + if loadModelOnStart { + do { + if self.model == nil { + let mymodel = try await TexTellerModel.asyncInit() + self.model = mymodel + print("Loaded da model") + } + } catch { + print("Failed to load da model: \(error)") } + } } } } @@ -125,17 +125,17 @@ struct MenuBarView: View { if panel.runModal() == .OK { if let url = panel.url, let image = NSImage(contentsOf: url) { let newSnippet = ImageSnippet(image: image) - if self.loadModelOnStart == false { - do { - if self.model == nil { - let mymodel = try TexTellerModel() - self.model = mymodel - print("Loaded model on demand") - } - } catch { - print("Failed to load da model: \(error)") - } + if self.loadModelOnStart == false { + do { + if self.model == nil { + let mymodel = try TexTellerModel() + self.model = mymodel + print("Loaded model on demand") + } + } catch { + print("Failed to load da model: \(error)") } + } do { if self.model != nil { let latex = try self.model!.texIt(image) @@ -146,9 +146,9 @@ struct MenuBarView: View { } catch { print("Failed to save new snippet: \(error)") } - if self.loadModelOnStart == false { - self.model = nil - } + if self.loadModelOnStart == false { + self.model = nil + } } } } @@ -184,17 +184,17 @@ struct MenuBarView: View { if FileManager.default.fileExists(atPath: tempPath) { if let screenshotImage = NSImage(contentsOfFile: tempPath) { let newSnippet = ImageSnippet(image: screenshotImage) - if self.loadModelOnStart == false { - do { - if self.model == nil { - let mymodel = try TexTellerModel() - self.model = mymodel - print("Loaded model on demand") - } - } catch { - print("Failed to load da model: \(error)") - } + if self.loadModelOnStart == false { + do { + if self.model == nil { + let mymodel = try TexTellerModel() + self.model = mymodel + print("Loaded model on demand") + } + } catch { + print("Failed to load da model: \(error)") } + } do { if self.model != nil { let latex = try self.model!.texIt(screenshotImage) @@ -205,9 +205,9 @@ struct MenuBarView: View { } catch { print("Failed to add snippet: \(error)") } - if (self.loadModelOnStart == false) { - self.model = nil - } + if self.loadModelOnStart == false { + self.model = nil + } } else { print("Failed to get image...") } |