Bladeren bron

chore: linter

Sam Jaffe 2 weken geleden
bovenliggende
commit
716ff24410

+ 7 - 7
Todos/Controller/SaveController.swift

@@ -11,15 +11,15 @@ final class SaveController {
   static func filename(date: String) -> URL {
     URL.documentsDirectory.appending(path: "Weekly Tracker \(date).yml")
   }
-  
-  static func save(_ items: [Project], to: URL) {
-    save(data: Data(items.map({ $0.yaml() }).joined().utf8), to: to)
+
+  static func save(_ items: [Project], toUrl: URL) {
+    save(data: Data(items.map({ $0.yaml() }).joined().utf8), toUrl: toUrl)
   }
-  
-  static func save(data: Data, to: URL) {
+
+  static func save(data: Data, toUrl: URL) {
     do {
-      try data.write(to: to, options: [.atomic, .completeFileProtection])
-      let input = try String(contentsOf: to, encoding: .utf8)
+      try data.write(to: toUrl, options: [.atomic, .completeFileProtection])
+      let input = try String(contentsOf: toUrl, encoding: .utf8)
       print(input)
     } catch {
       print(error.localizedDescription)

+ 54 - 54
Todos/Model/Category.swift

@@ -13,104 +13,104 @@ import SwiftUI
 // Make Color codable. This includes support for transparency.
 // See https://www.digitalocean.com/community/tutorials/css-hex-code-colors-alpha-values
 extension Color: @retroactive Codable {
-#if os(macOS)
-    fileprivate typealias UnifiedColor = NSColor
-#endif
-    
-#if os(iOS)
-    fileprivate typealias UnifiedColor = UIColor
-#endif
-  
+  #if os(macOS)
+  fileprivate typealias UnifiedColor = NSColor
+  #endif
+
+  #if os(iOS)
+  fileprivate typealias UnifiedColor = UIColor
+  #endif
+
   init(hex: String) {
     var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
     hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")
-    
+
     var rgb: UInt64 = 0
-    
-    var r: CGFloat = 0.0
-    var g: CGFloat = 0.0
-    var b: CGFloat = 0.0
-    var a: CGFloat = 1.0
-    
+
+    var red: CGFloat = 0.0
+    var green: CGFloat = 0.0
+    var blue: CGFloat = 0.0
+    var opacity: CGFloat = 1.0
+
     let length = hexSanitized.count
-    
+
     Scanner(string: hexSanitized).scanHexInt64(&rgb)
-    
+
     if length == 6 {
-      r = CGFloat((rgb & 0xFF0000) >> 16) / 255.0
-      g = CGFloat((rgb & 0x00FF00) >> 8) / 255.0
-      b = CGFloat(rgb & 0x0000FF) / 255.0
+      red = CGFloat((rgb & 0xFF0000) >> 16) / 255.0
+      green = CGFloat((rgb & 0x00FF00) >> 8) / 255.0
+      blue = CGFloat(rgb & 0x0000FF) / 255.0
     } else if length == 8 {
-      r = CGFloat((rgb & 0xFF000000) >> 24) / 255.0
-      g = CGFloat((rgb & 0x00FF0000) >> 16) / 255.0
-      b = CGFloat((rgb & 0x0000FF00) >> 8) / 255.0
-      a = CGFloat(rgb & 0x000000FF) / 255.0
+      red = CGFloat((rgb & 0xFF000000) >> 24) / 255.0
+      green = CGFloat((rgb & 0x00FF0000) >> 16) / 255.0
+      blue = CGFloat((rgb & 0x0000FF00) >> 8) / 255.0
+      opacity = CGFloat(rgb & 0x000000FF) / 255.0
     }
 
     self.init(.sRGB,
-              red: Double(r),
-              green: Double(g),
-              blue: Double(b),
-              opacity: Double(a))
+          red: Double(red),
+          green: Double(green),
+          blue: Double(blue),
+          opacity: Double(opacity))
   }
-  
+
   public init(from decoder: Decoder) throws {
     let container = try decoder.singleValueContainer()
     let hex = try container.decode(String.self)
-    
+
     self.init(hex: hex)
   }
-  
+
   public func encode(to encoder: Encoder) throws {
     var container = encoder.singleValueContainer()
     try container.encode(hex)
   }
-  
+
   var hex: String? {
     return toHex()
   }
-  
+
   func toHex(alpha: Bool = false) -> String? {
     guard let components = UnifiedColor(self).cgColor.components, components.count >= 3 else {
-        return nil
+      return nil
     }
-    
-    let r = Float(components[0])
-    let g = Float(components[1])
-    let b = Float(components[2])
-    var a = Float(1.0)
-    
+
+    let red = Float(components[0])
+    let green = Float(components[1])
+    let blue = Float(components[2])
+    var opacity = Float(1.0)
+
     if components.count >= 4 {
-      a = Float(components[3])
+      opacity = Float(components[3])
     }
-    
+
     if alpha {
       return String(format: "%02lX%02lX%02lX%02lX",
-                    lroundf(r * 255),
-                    lroundf(g * 255),
-                    lroundf(b * 255),
-                    lroundf(a * 255))
+              lroundf(red * 255),
+              lroundf(green * 255),
+              lroundf(blue * 255),
+              lroundf(opacity * 255))
     } else {
       return String(format: "%02lX%02lX%02lX",
-                    lroundf(r * 255),
-                    lroundf(g * 255),
-                    lroundf(b * 255))
+              lroundf(red * 255),
+              lroundf(green * 255),
+              lroundf(blue * 255))
     }
   }
 }
 
-final class Category : Identifiable, Codable {
+final class Category: Identifiable, Codable {
   var name: String = ""
   var color: Color = Color(.gray)
-  
+
   var id: String { name }
-  
+
   init() {}
-  
+
   init(name: String, color: Color) {
     self.name = name
     self.color = color
   }
-  
+
   var valid: Bool { !name.isEmpty }
 }

+ 10 - 10
Todos/Model/Project.swift

@@ -9,29 +9,29 @@ import Foundation
 import SwiftData
 
 @Model
-final class Project : Codable {
+final class Project: Codable {
   var sortOrder: Int = 0
   var timestamp: Date
   var category: String = ""
   var name: String = "New Project"
-  @Relationship(deleteRule: .cascade, inverse:\Task.project)
+  @Relationship(deleteRule: .cascade, inverse: \Task.project)
   var tasks: [Task] = []
-  
+
   init(timestamp: Date) {
     self.timestamp = timestamp
   }
-  
+
   func yaml(_ indent: Int = 0) -> String {
-    let h1 = String(repeating: "  ", count: indent)
-    var rval = h1 + "\(name):\n"
+    let hdr = String(repeating: "  ", count: indent)
+    var rval = hdr + "\(name):\n"
     if !category.isEmpty {
-      rval += h1 + "  # In Category: \(category)\n"
+      rval += hdr + "  # In Category: \(category)\n"
     }
     rval += tasks.map({ $0.yaml(indent + 1) }).joined()
     return rval
   }
-  
-  enum CodingKeys : CodingKey { case timestamp, category, name, tasks }
+
+  enum CodingKeys: CodingKey { case timestamp, category, name, tasks }
 
   required init(from decoder: any Decoder) throws {
     let container = try decoder.container(keyedBy: CodingKeys.self)
@@ -40,7 +40,7 @@ final class Project : Codable {
     name = try container.decode(String.self, forKey: .name)
     tasks = try container.decode([Task].self, forKey: .tasks)
   }
-  
+
   func encode(to encoder: any Encoder) throws {
     var container = encoder.container(keyedBy: CodingKeys.self)
     try container.encode(timestamp, forKey: .timestamp)

+ 27 - 27
Todos/Model/Task.swift

@@ -8,52 +8,52 @@
 import Foundation
 import SwiftData
 
-enum Status : String, CaseIterable, Identifiable, Codable {
+enum Status: String, CaseIterable, Identifiable, Codable {
   case Todo = " "
   case Complete = "V"
   case InProgress = "C"
   case Hiatus = "H"
   case Waiting = "R"
-  
+
   var id: Self { self }
   var description: String { self.rawValue }
   var isStrong: Bool {
     self == .Complete || self == .Hiatus || self == .Waiting
   }
   var label: String {
-    switch (self) {
-      case .Todo: return "square.and.pencil"
-      case .Complete: return "checkmark"
-      case .InProgress: return "ellipsis.circle"
-      case .Hiatus: return "clock.badge.questionmark"
-      case .Waiting: return "airplane.circle"
+    switch self {
+    case .Todo: return "square.and.pencil"
+    case .Complete: return "checkmark"
+    case .InProgress: return "ellipsis.circle"
+    case .Hiatus: return "clock.badge.questionmark"
+    case .Waiting: return "airplane.circle"
     }
   }
 }
 
 @Model
-final class SubTask : Codable {
+final class SubTask: Codable {
   var name: String
   var task: Task?
   var notes: String = ""
   var status: Status = Status.Todo
-  
+
   init(name: String, parent: Task? = nil) {
     self.name = name
     self.task = parent
   }
-  
+
   func yaml(_ indent: Int = 0) -> String {
-    let h1 = String(repeating: "  ", count: indent)
-    let h2 = String(repeating: "  ", count: indent + 1)
-    var rval = h1 + "- [\(status.rawValue)] \(name)\n"
+    let hdr = String(repeating: "  ", count: indent)
+    let subhdr = hdr + "  # "
+    var rval = hdr + "- [\(status.rawValue)] \(name)\n"
     if !notes.isEmpty {
-      rval += h2 + "# " + notes.replacingOccurrences(of: "\n", with: "\n" + h2 + "# ") + "\n"
+      rval += subhdr + notes.replacingOccurrences(of: "\n", with: "\n" + subhdr) + "\n"
     }
     return rval
   }
 
-  enum CodingKeys : CodingKey { case name, notes, status }
+  enum CodingKeys: CodingKey { case name, notes, status }
 
   required init(from decoder: any Decoder) throws {
     let container = try decoder.container(keyedBy: CodingKeys.self)
@@ -71,7 +71,7 @@ final class SubTask : Codable {
 }
 
 @Model
-final class Tag : Codable {
+final class Tag: Codable {
   var id: String
   var task: Task?
 
@@ -95,7 +95,7 @@ final class Tag : Codable {
 }
 
 @Model
-final class Task : Codable {
+final class Task: Codable {
   var name: String
   var project: Project?
   var category: String = ""
@@ -105,26 +105,26 @@ final class Task : Codable {
   var subtasks: [SubTask] = []
   var notes: String = ""
   var status: Status = Status.Todo
-  
+
   init(name: String, parent: Project? = nil) {
     self.name = name
     self.project = parent
     self.category = parent?.category ?? ""
   }
-  
+
   func yaml(_ indent: Int = 0) -> String {
-    let h1 = String(repeating: "  ", count: indent)
-    let h2 = String(repeating: "  ", count: indent + 1)
-    var rval = h1 + "[\(status.rawValue)] \(name) "
+    let hdr = String(repeating: "  ", count: indent)
+    let subhdr = hdr + "  # "
+    var rval = hdr + "[\(status.rawValue)] \(name) "
     rval += "(\(tags.map(\.id).joined(separator: " ")))\n"
     if !notes.isEmpty {
-      rval += h2 + "# " + notes.replacingOccurrences(of: "\n", with: "\n" + h2 + "# ") + "\n"
+      rval += subhdr + notes.replacingOccurrences(of: "\n", with: "\n" + subhdr) + "\n"
     }
     rval += subtasks.map({ $0.yaml(indent + 1) }).joined()
     return rval
   }
-  
-  enum CodingKeys : CodingKey { case name, category, tags, subtasks, notes, status }
+
+  enum CodingKeys: CodingKey { case name, category, tags, subtasks, notes, status }
 
   required init(from decoder: any Decoder) throws {
     let container = try decoder.container(keyedBy: CodingKeys.self)
@@ -135,7 +135,7 @@ final class Task : Codable {
     notes = try container.decode(String.self, forKey: .notes)
     status = try container.decode(Status.self, forKey: .status)
   }
-  
+
   func encode(to encoder: any Encoder) throws {
     var container = encoder.container(keyedBy: CodingKeys.self)
     try container.encode(name, forKey: .name)

+ 7 - 7
Todos/Model/URLHint.swift

@@ -8,27 +8,27 @@
 import Foundation
 import SwiftData
 
-final class URLHint : Identifiable, Codable {
+final class URLHint: Identifiable, Codable {
   var prefix: String = ""
   var replacement: String = ""
-  
+
   var id: String { prefix }
-  
+
   init() {}
-  
+
   init(prefix: String, replacement: String) {
     self.prefix = prefix
     self.replacement = replacement
   }
-  
+
   func matches(_ tag: Tag) -> Bool {
     return tag.id.hasPrefix(prefix)
   }
-  
+
   func url(_ tag: Tag) -> URL {
     let url = tag.id.replacingOccurrences(of: prefix, with: replacement)
     return URL(string: url)!
   }
-  
+
   var valid: Bool { !prefix.isEmpty && !replacement.isEmpty }
 }

+ 2 - 2
Todos/TodosApp.swift

@@ -22,7 +22,7 @@ struct TodosApp: App {
       Project.self,
       Task.self,
       SubTask.self,
-      Tag.self,
+      Tag.self
     ])
     let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
 
@@ -57,7 +57,7 @@ struct TodosApp: App {
           .modelContainer(sharedModelContainer)
       }
     }
-    
+
     #if os(macOS)
     Settings {
       SettingsView()

+ 19 - 19
Todos/View/ContentView.swift

@@ -12,7 +12,7 @@ struct ContentView: View {
   @Environment(\.modelContext) private var modelContext
   @AppStorage(UserDefaultsKeys.WeekStart) private var weekStart = Date()
   let inPreview = ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1"
-  
+
   @Query(sort: \Project.sortOrder) private var items: [Project]
   @State private var selection: Project?
 
@@ -23,7 +23,9 @@ struct ContentView: View {
           NavigationLink(value: item) {
             Text(item.name)
           } .contextMenu {
-            Button(action: { deleteItem(item: item) }) {
+            Button {
+              deleteItem(item: item)
+            } label: {
               Label("Delete", systemImage: "trash")
             }
           }
@@ -56,38 +58,38 @@ struct ContentView: View {
       modelContext.insert(newItem)
     }
   }
-  
+
   private func reOrder(fromOffsets: IndexSet, toOffset: Int) {
-    var s = items.sorted(by: { $0.sortOrder < $1.sortOrder })
-    s.move(fromOffsets: fromOffsets, toOffset: toOffset)
-    for (index, item) in s.enumerated() {
+    var tmp = items.sorted(by: { $0.sortOrder < $1.sortOrder })
+    tmp.move(fromOffsets: fromOffsets, toOffset: toOffset)
+    for (index, item) in tmp.enumerated() {
       item.sortOrder = index
     }
     try? self.modelContext.save()
   }
-  
+
   private func autosave() {
     if inPreview {
       // This isn't great, but we shouldn't be running this in a preview
       // environment in the first place, so w/e.
       return
     }
-    
+
     let now = Date()
     let sunday = Calendar.current.nextDate(after: weekStart,
-                                           matching: DateComponents(weekday: 1),
-                                           matchingPolicy: .nextTime)
+                         matching: DateComponents(weekday: 1),
+                         matchingPolicy: .nextTime)
 
     if now <= sunday! {
       return
     }
-    
+
     let ymd = weekStart.formatted(.iso8601.year().month().day())
-    SaveController.save(items, to: SaveController.filename(date: ymd))
+    SaveController.save(items, toUrl: SaveController.filename(date: ymd))
     weekStart = now
     cleanup()
   }
-  
+
   private func cleanup() {
     for item in items {
       item.tasks.removeAll(where: { $0.status == .Complete })
@@ -97,15 +99,13 @@ struct ContentView: View {
         }
 
         task.subtasks.removeAll(where: { $0.status == .Complete })
-        for subtask in task.subtasks {
-          if subtask.status == .InProgress {
-            subtask.status = .Todo
-          }
+        for subtask in task.subtasks where subtask.status == .InProgress {
+          subtask.status = .Todo
         }
       }
     }
   }
-  
+
   private func deleteItem(item: Project) {
     if let selection = selection, selection == item {
       self.selection = nil
@@ -129,5 +129,5 @@ struct ContentView: View {
 
 #Preview {
   ContentView()
-      .modelContainer(for: Project.self, inMemory: true)
+    .modelContainer(for: Project.self, inMemory: true)
 }

+ 2 - 2
Todos/View/Menu/ExportMenu.swift

@@ -23,7 +23,7 @@ struct ExportMenu: View {
     }
     .keyboardShortcut("E", modifiers: [.command, .shift])
     .fileExporter(isPresented: $showingExporter, document: StubJsonDocument(),
-                  contentType: .json) { result in
+            contentType: .json) { result in
       switch result {
       case .success(let url):
         let transfer = Transfer(projects: items, hints: allHints, categories: allGroups)
@@ -31,7 +31,7 @@ struct ExportMenu: View {
         else {
           return
         }
-        SaveController.save(data: data, to: url)
+        SaveController.save(data: data, toUrl: url)
       case .failure(let error):
         print(error.localizedDescription)
       }

+ 4 - 4
Todos/View/Menu/ImportMenu.swift

@@ -24,16 +24,16 @@ struct ImportMenu: View {
     .fileImporter(isPresented: $showingExporter, allowedContentTypes: [.json]) { result in
       switch result {
       case .success(let url):
-        
+
         guard let data = try? Data(contentsOf: url),
-              let transfer = try? JSONDecoder().decode(Transfer.self, from: data)
+            let transfer = try? JSONDecoder().decode(Transfer.self, from: data)
         else {
           return
         }
-        
+
         do {
           try modelContext.container.erase()
-          
+
           transfer.projects.forEach(modelContext.insert)
           allGroups = transfer.categories
           allHints = transfer.hints

+ 1 - 1
Todos/View/Menu/NewProjectMenu.swift

@@ -16,7 +16,7 @@ struct NewProjectMenu: View {
     Button("New Project", action: addItem)
       .keyboardShortcut("N", modifiers: [.command])
   }
-  
+
   private func addItem() {
     withAnimation {
       let newItem = Project(timestamp: Date())

+ 3 - 3
Todos/View/Menu/SaveAsMenu.swift

@@ -11,7 +11,7 @@ import UniformTypeIdentifiers
 
 struct SaveAsMenu: View {
   @Environment(\.modelContext) private var modelContext
-  
+
   @Query private var items: [Project]
   @State private var showingExporter = false
 
@@ -21,10 +21,10 @@ struct SaveAsMenu: View {
     }
     .keyboardShortcut("S", modifiers: [.command, .shift])
     .fileExporter(isPresented: $showingExporter, document: StubYamlDocument(),
-                  contentType: .yaml) { result in
+            contentType: .yaml) { result in
       switch result {
       case .success(let url):
-        SaveController.save(items, to: url)
+        SaveController.save(items, toUrl: url)
       case .failure(let error):
         print(error.localizedDescription)
       }

+ 3 - 3
Todos/View/Menu/SaveSnapshotMenu.swift

@@ -10,13 +10,13 @@ import SwiftData
 
 struct SaveSnapshotMenu: View {
   @Environment(\.modelContext) private var modelContext
-  
+
   @Query private var items: [Project]
-  
+
   var body: some View {
     Button("Save Snapshot") {
       let snapshot = Date().formatted(.iso8601)
-      SaveController.save(items, to: SaveController.filename(date: snapshot))
+      SaveController.save(items, toUrl: SaveController.filename(date: snapshot))
     }
     .keyboardShortcut("S", modifiers: .command)
   }

+ 3 - 3
Todos/View/ProjectPanelView.swift

@@ -73,7 +73,7 @@ struct ProjectPanelView: View {
       }).moveDisabled(!move)
     }
   }
-    
+
   private func addItem() {
     withAnimation {
       let newTask = Task(name: "New Task", parent: item)
@@ -81,14 +81,14 @@ struct ProjectPanelView: View {
       item.tasks.append(newTask)
     }
   }
-  
+
   private func deleteItem(item: Task, from: Project) {
     withAnimation {
       from.tasks.removeAll(where: { $0.id == item.id })
       modelContext.delete(item)
     }
   }
-  
+
   private func deleteItem(item: SubTask, from: Task) {
     withAnimation {
       from.subtasks.removeAll(where: { $0.id == item.id })

+ 3 - 3
Todos/View/Settings/CategorySettingsView.swift

@@ -10,7 +10,7 @@ import SwiftUI
 struct CategorySettingsView: View {
   @AppStorage(UserDefaultsKeys.Category) var allGroups = CodableArray<Category>()
   @State var active = Category()
-  
+
   var body: some View {
     Table(of: Binding<Category>.self) {
       TableColumn("Color") { group in
@@ -22,7 +22,7 @@ struct CategorySettingsView: View {
       }
       TableColumn("") { group in
         if group.id != active.id {
-          Button() {
+          Button {
             allGroups.removeAll(where: { $0.id == group.id })
           } label: {
             Label("", systemImage: "trash")
@@ -36,7 +36,7 @@ struct CategorySettingsView: View {
       TableRow($active)
     }
   }
-  
+
   private func addGroup() {
     if active.valid {
       allGroups.append(active)

+ 2 - 2
Todos/View/Settings/URLHintSettingsView.swift

@@ -24,7 +24,7 @@ struct URLHintSettingsView: View {
       }
       TableColumn("") { hint in
         if hint.id != active.id {
-          Button() {
+          Button {
             allHints.removeAll(where: { $0.id == hint.id })
           } label: {
             Label("", systemImage: "trash")
@@ -38,7 +38,7 @@ struct URLHintSettingsView: View {
       TableRow($active)
     }
   }
-  
+
   private func addHint() {
     if active.valid {
       allHints.append(active)

+ 3 - 3
Todos/View/SubTaskView.swift

@@ -9,7 +9,7 @@ import SwiftUI
 
 struct SubTaskView: View {
   @Binding var task: SubTask
-  
+
   @State private var hideNotes: Bool = false
 
   @FocusState private var isFocused: Bool
@@ -34,7 +34,7 @@ struct SubTaskView: View {
           .focused($isFocused)
       }
 
-      if isFocused || !(hideNotes || task.notes.isEmpty){
+      if isFocused || !(hideNotes || task.notes.isEmpty) {
         HStack {
           TextField("Notes", text: $task.notes)
             .font(.footnote)
@@ -49,5 +49,5 @@ struct SubTaskView: View {
 #Preview {
   @Previewable @State var task = SubTask(name: "New Task")
   SubTaskView(task: $task)
-      .frame(minHeight: 100) // Preview does not resize window properly
+    .frame(minHeight: 100) // Preview does not resize window properly
 }

+ 2 - 2
Todos/View/TagBarView.swift

@@ -15,7 +15,7 @@ struct TagBarView: View {
 
   @State private var active: String = ""
   @FocusState private var isFocused: Bool
-  
+
   var body: some View {
     HStack {
       ForEach($task.tags) { tag in
@@ -40,7 +40,7 @@ struct TagBarView: View {
         .onSubmit(addItem)
     }
   }
-  
+
   private func addItem() {
     if !active.isEmpty && !task.tags.contains(where: { $0.like(active) }) {
       let newTag = Tag(id: active, parent: task)

+ 4 - 4
Todos/View/TaskView.swift

@@ -41,7 +41,7 @@ struct TaskView: View {
               .forEach({ subtask in subtask.status = task.status })
           }
         }
-        
+
         TextField("Task Name", text: $task.name)
           .focused($isFocused)
         Button(action: addItem) {
@@ -49,7 +49,7 @@ struct TaskView: View {
             .help("Add a Subtask")
         }
       }
-      
+
       if isFocused || !(hideTags || task.tags.isEmpty) {
         HStack {
           TagBarView(task: $task)
@@ -67,7 +67,7 @@ struct TaskView: View {
           VisibilityTapper(hideToggle: $hideTags)
         }.focused($isFocused)
       }
-      
+
       if isFocused || !(hideNotes || task.notes.isEmpty) {
         HStack {
           TextField("Notes", text: $task.notes, axis: .vertical)
@@ -98,5 +98,5 @@ struct TaskView: View {
 #Preview {
   @Previewable @State var task = Task(name: "New Task")
   TaskView(task: $task)
-      .frame(minHeight: 100) // Preview does not resize window properly
+    .frame(minHeight: 100) // Preview does not resize window properly
 }

+ 1 - 1
Todos/View/VisibilityTapper.swift

@@ -9,7 +9,7 @@ import SwiftUI
 
 struct VisibilityTapper: View {
   @Binding var hideToggle: Bool
-  
+
   var body: some View {
     Label("", systemImage: hideToggle ? "eye.slash" : "eye")
       .onTapGesture {

+ 2 - 2
Todos/ViewModel/CodableArray.swift

@@ -23,7 +23,7 @@ typealias CodableArray<A: Codable> = [A]
  * The \@retroactive guards against the Swift developers changing Array<T> to
  * comply w/ RawRepresentable in the future
  */
-extension CodableArray : @retroactive RawRepresentable {
+extension CodableArray: @retroactive RawRepresentable {
   public init?(rawValue: String) {
     guard let data = rawValue.data(using: .utf8),
           let result = try? JSONDecoder().decode(CodableArray.self, from: data)
@@ -32,7 +32,7 @@ extension CodableArray : @retroactive RawRepresentable {
     }
     self = result
   }
-  
+
   public var rawValue: String {
     guard let data = try? JSONEncoder().encode(self),
           let result = String(data: data, encoding: .utf8)

+ 8 - 8
Todos/ViewModel/StubDocument.swift

@@ -9,25 +9,25 @@ import Foundation
 import SwiftUI
 import UniformTypeIdentifiers
 
-struct StubYamlDocument : FileDocument {
+struct StubYamlDocument: FileDocument {
   static var readableContentTypes = [UTType.yaml]
-    
+
   init() {}
-  
+
   init(configuration: ReadConfiguration) throws {}
-  
+
   func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
     return FileWrapper(regularFileWithContents: Data())
   }
 }
 
-struct StubJsonDocument : FileDocument {
+struct StubJsonDocument: FileDocument {
   static var readableContentTypes = [UTType.json]
-  
+
   init() {}
-  
+
   init(configuration: ReadConfiguration) throws {}
-  
+
   func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
     return FileWrapper(regularFileWithContents: Data())
   }

+ 2 - 2
Todos/ViewModel/Transfer.swift

@@ -7,11 +7,11 @@
 
 import Foundation
 
-final class Transfer : Codable {
+final class Transfer: Codable {
   var projects: [Project]
   var hints: [URLHint]
   var categories: [Category]
-  
+
   init(projects: [Project], hints: [URLHint], categories: [Category]) {
     self.projects = projects
     self.hints = hints