Преглед изворни кода

refactor: don't add trailing number

Sam Jaffe пре 2 недеља
родитељ
комит
873dccc138
2 измењених фајлова са 0 додато и 8 уклоњено
  1. 0 4
      Todos/View/ContentView.swift
  2. 0 4
      Todos/View/Menu/NewProjectMenu.swift

+ 0 - 4
Todos/View/ContentView.swift

@@ -52,10 +52,6 @@ struct ContentView: View {
   private func addItem() {
     withAnimation {
       let newItem = Project(timestamp: Date())
-      let count = items.count(where: { $0.name.starts(with: "New Project") })
-      if (count > 0) {
-        newItem.name += " (\(count))"
-      }
       modelContext.insert(newItem)
     }
   }

+ 0 - 4
Todos/View/Menu/NewProjectMenu.swift

@@ -20,10 +20,6 @@ struct NewProjectMenu: View {
   private func addItem() {
     withAnimation {
       let newItem = Project(timestamp: Date())
-      let count = items.count(where: { $0.name.starts(with: "New Project") })
-      if (count > 0) {
-        newItem.name += " (\(count))"
-      }
       modelContext.insert(newItem)
     }
   }