I want to write an app that uses local notification and send me notification regardless of which view/screen I am on a multi view application.
For simplicity, let say I have 2 view controllers each has a button on it.
For example
class ViewController1: UIViewController {
has a button on it and when is pressed will take me to
class ViewController2: UIViewController {
and this class has button on it and when is pressed will take me back to ViewController1
so far I have no issues with implementing this, but I want to have a class that handles the local notification in a way to send me “Hello Word” alert every mins regardless of if I am currently on ViewController1 or ViewController2 screen.
I don’t want the code that handles the local notification be part of either ViewController1 or ViewController2, but rather have its own class.
So basically all I want a class that handles local notification and not be part of any viewcontroller. What is the requirements for writing such a class in Swift? is there an example that someone can share?
Thanks
Borna