I am trying to figure out how to reset a label in an app after every 7 days even though the user launches the app on the 8th day.
To simplify the approach I have a label with a string set to it in ViewDidLoad.
override func viewDidLoad() {
super.viewDidLoad()
self.nameLabel.text = "Today"
// Check for the current day
let date = Date()
let formatter = DateFormatter()
formatter.dateFormat = "EEEE"
let WeekDay = formatter.string(from: date)
}
I can check for which day it is but is there a way to ensure I save the day and then check if the day has passed Sunday to then change the label to something else?
Thanks in advance.