diff --git a/LeCountdown/Views/NewCountdownView.swift b/LeCountdown/Views/NewCountdownView.swift index 141e4e2..9335e85 100644 --- a/LeCountdown/Views/NewCountdownView.swift +++ b/LeCountdown/Views/NewCountdownView.swift @@ -188,7 +188,8 @@ struct CountdownEditView : View { cd.duration = self._minutes * 60.0 + self._seconds if self._isAdding { - cd.order = Int16(self.countdowns.count) + let max = self.countdowns.map { $0.order }.max() ?? 0 + cd.order = max + 1 } if !self.nameString.isEmpty { cd.activity = CoreDataRequests.getOrCreateActivity(name: self.nameString)