Hello,
So I am trying to make a notification repeat every 5 hours. I figured out how to make it start at a specific time using datecomponents but I can’t figure out how to make it repeat or go off at another time.
Button("Available: 9AM-3PM-7PM") {
let content = UNMutableNotificationContent()
content.title = "Feed \(dogsName)"
content.sound = UNNotificationSound.default
var dateComponents = DateComponents()
dateComponents.hour = 9
dateComponents.minute = 00
let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request)
}