Hi I am following the "iOS App Dev Tutorials" - https://developer.apple.com/tutorials/app-dev-training/updating-app-data and I found this bug using Xcode 12.5.
.onAppear {
scrumTimer.reset(lengthInMinutes: scrum.lengthInMinutes, attendees: scrum.attendees)
scrumTimer.startScrum()
scrumTimer.speakerChangedAction = {
player.seek(to: .zero)
player.play()
}
}
.onDisappear {
scrumTimer.stopScrum()
let newHistory = History(attendees: scrum.attendees, lengthInMinutes: scrumTimer.secondsElapsed / 60)
scrum.history.insert(newHistory, at: 0)
The results is that when the view is shown, the onAppear is executed, then the onDisappear is executed and then again the onAppear. The results is that I have in the history 2 copies of the same entry.