diff --git a/LeCountdown/Sound/Sound.swift b/LeCountdown/Sound/Sound.swift index 54c91f6..875ecc0 100644 --- a/LeCountdown/Sound/Sound.swift +++ b/LeCountdown/Sound/Sound.swift @@ -79,7 +79,7 @@ enum Sound: Int, CaseIterable, Identifiable, Localized { switch self { case .trainhorn: return NSLocalizedString("Train horn", comment: "") case .forestStream: return NSLocalizedString("Forest stream", comment: "") - case .sbSEM_Synths_Loop4_Nothing_Like_You: return "Nothing_Like_You" + case .sbSEM_Synths_Loop4_Nothing_Like_You: return "Nothing Like You" case .sbClave_Loop_LLL: return "LLL" case .sbLoop_ToneSD_Boavista: return "Boavista" case .sbArpeggio_Loop_River: return "River 1" diff --git a/LeCountdown/Views/Countdown/NewCountdownView.swift b/LeCountdown/Views/Countdown/NewCountdownView.swift index 49d6e6a..e63ed6b 100644 --- a/LeCountdown/Views/Countdown/NewCountdownView.swift +++ b/LeCountdown/Views/Countdown/NewCountdownView.swift @@ -54,8 +54,13 @@ struct CountdownEditView : View { private var countdowns: FetchedResults @State var _isAdding: Bool = false + @State var _hasLoaded = false @Environment(\.isPresented) var envIsPresented +// +// init() { +// self._load() +// } var body: some View { NavigationStack { @@ -63,7 +68,7 @@ struct CountdownEditView : View { .frame(width: 0.0, height: 0.0) .onChange(of: envIsPresented) { newValue in if !newValue && !self._isAdding { - self._save() + self._save() // save when leaving an edit screen } } CountdownFormView( @@ -141,14 +146,16 @@ struct CountdownEditView : View { fileprivate func _onAppear() { -// self.playlists = PlaylistSelection.allPlaylists() - self._isAdding = (self.countdown == nil) - + if !self._hasLoaded { + self._load() + self._hasLoaded = true + } + } + + fileprivate func _load() { if let countdown { - print("self.soundList = \(countdown.soundList)") - let minutes = Int(countdown.duration / 60.0) let seconds = countdown.duration - Double(minutes * 60) @@ -175,7 +182,6 @@ struct CountdownEditView : View { self.image = coolpic } } - } fileprivate let _numberFormatter = NumberFormatter()