Adds animation

release
Laurent 3 years ago
parent ce8426dbf0
commit 21d21f8c81
  1. 10
      LeCountdown/Conductor.swift

@ -8,6 +8,7 @@
import Foundation
import ActivityKit
import BackgroundTasks
import SwiftUI
enum Key: String {
case countdowns
@ -33,14 +34,18 @@ class Conductor: ObservableObject {
@Published var currentCountdowns: [String : DateInterval] = [:] {
didSet {
Conductor.savedCountdowns = currentCountdowns
self._buildLiveTimers()
withAnimation {
self._buildLiveTimers()
}
}
}
@Published var currentStopwatches: [String : Date] = [:] {
didSet {
Conductor.savedStopwatches = currentStopwatches
self._buildLiveTimers()
withAnimation {
self._buildLiveTimers()
}
}
}
@ -51,6 +56,7 @@ class Conductor: ObservableObject {
}
fileprivate func _buildLiveTimers() {
let liveCountdowns = self.currentCountdowns.map {
return LiveTimer(id: $0, date: $1.end)
}

Loading…
Cancel
Save