Como posso definir uma notificação que UserNotifications Framework
Posso definir uma notificação em um intervalo de tempo, mas não sei como fazê-la em uma data e hora específicas. Tentei isso, mas não funcionou
let center = UNUserNotificationCenter.current()
func notificationSender(){
center.requestAuthorization([.sound, .alert]) {
(granted, error) in
// We can register for remote notifications here too!
}
var date = DateComponents()
date.hour = 13
date.minute = 57
let trigger = UNCalendarNotificationTrigger.init(dateMatching: date , repeats: false)
let content = UNNotificationContent()
// edit your content
let notification = UNNotificationRequest(identifier: "myNotification", content: content, trigger: trigger)
center.add (notificação)}
a notificação precisa ser repetida todas as segundas e sextas às 15:00