I want to ask how I can set a reminder from a string and give you a notification 10 minutes before the exact time and after that the UI change from time a to time b.
let a = "04:12"
let b = "11:38"
let c = "15:00"
let d = "18:03"
let e ="18:59"
I am setting up the timer like this but I don't know where I should go from here. This is my code:
extension Date {
var hour: Int { return Calendar.current.component(.hour, from: self)}
var minute: Int { return Calendar.current.component(.minute, from: self)}
}
@objc func scheduleTime() {
timer = Timer(fireAt: Calendar.current.nextDate(after: Date(), matching: DateComponents(hour: 0...23 ~= Date().hour ? 23 : 0), matchingPolicy: .nextTime)!, interval: 0, target: self, selector: #selector(updateUI), userInfo: nil, repeats: false)
RunLoop.main.add(timer, forMode: .common)
}