Countdown in the background problem

I have built a small animated countdown app using UIKit and SwiftUI, where the animated timer itself was built with SwiftUI. The countdown counts until zero and then beeps. Here are my problems: when I switch to another window app on my iPhone and then switch back to the timer, the countdown continues to run again from the place it was left. The other problem is that it doesn’t beep when the window is switched, only when I go back to the App.
I am not sure where to look for solution, because I prefer not to use notifications because, all I want is the timer to go on while in the background. I watched “Background Tasks” in the Ray’s library but it does not talk about timers.
Any piece of advice will be appreciated!

I found a solution, not tried it yet but it sounds right. I can use Notification Center with sounds only.
https://developer.apple.com/documentation/usernotifications/scheduling_a_notification_locally_from_your_app

This topic was automatically closed after 166 days. New replies are no longer allowed.