I have an app that gives you a quote everyday in a notification and displays it with a label in the main view controller. It detects with a dateHasChanged()-function whether it's still the same day or not.
Here's my problem: if I (for example) have used the app on the first day and did not close it properly, then locked my smartphone so that it remains active until the next day, then unlocked my smartphone, my app would still display the old quote even though in the viewDidLoad() it says to check if the date has changed and optionally changed the label text to the new quote. To solve this problem, I already wrote a function in the main view controller like that:
func refresh() {
viewDidLoad()
}
and called it from the appDelegate (didFinishLaunchingWithOptions) like that:
let mvc = MainViewController()
mvc.refresh()
But it just gives me an error when running it. How can I refresh the screen after my app remained active in the background for a longer time?
Thank you for your help!