Przeglądaj źródła

fix: do not use the class-initializer for UUID()

Sam Jaffe 2 tygodni temu
rodzic
commit
bae8775fe6
2 zmienionych plików z 1 dodań i 2 usunięć
  1. 1 1
      Todos/Model/Project.swift
  2. 0 1
      Todos/View/ContentView.swift

+ 1 - 1
Todos/Model/Project.swift

@@ -13,7 +13,7 @@ import SwiftUI
 final class Project: Codable, Ordered, Aggregate {
   typealias Element = Task
 
-  var uuid: UUID = UUID()
+  var uuid: UUID
   var sortOrder: Int = 0
   var name: String = "New Project"
   var category: String = ""

+ 0 - 1
Todos/View/ContentView.swift

@@ -67,7 +67,6 @@ struct ContentView: View {
   }
 
   private func autosave() {
-    items.forEach({ $0.uuid = UUID() })
     if inPreview {
       // This isn't great, but we shouldn't be running this in a preview
       // environment in the first place, so w/e.