2

I'm making app where user set some point of time, for example 10 am, and at 10 am I want to execute some code, for example I want to print "Wake up!". Which type of background working or something different should I use? I want to add also options to set different days when code have to execute.

PS. I want to it will execute even while app will be terminated, something like alarm clock

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Jacob233
  • 312
  • 2
  • 4
  • 14

1 Answers1

-2

You can use this pod to accomplish this.

https://github.com/radex/SwiftyTimer

Timer.after(6.hours) {
   println("Time to wake up!!")
}
thexande
  • 1,645
  • 16
  • 23
  • Yes, timer is one of the few services that can run in the background, along with location, and downloads – Dan Feb 09 '17 at 22:20
  • No, it isn't. Timers do not run in the background, and certainly not if the app is terminated. – Paulw11 Feb 10 '17 at 02:17