Как я могу установить уведомление, которое UserNotifications Framework
Я могу установить уведомление за определенный промежуток времени, но я не знаю, как сделать это в определенное время и дату, я пытаюсь это сделать, но не работает
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 (уведомление)}
уведомление должно повторяться каждый понедельник и пятницу в 15:00.