Reputation: 65
I just want to send a local notification at 11:55 am Monday, Tuesday, Wednesday, Thursday and Friday. I couldn't find a detailed source. Can you help me?
Upvotes: 0
Views: 306
Reputation: 133
You can use UNCalendarNotificationTrigger
and create a trigger. You can set date, timezone, year, month, day, hour, minute and if need repeat or not.
Next, create a request UNNotificationRequest
, and finish adding the request to Notification Center.
Like this:
import UserNotifications
let trigger = UNCalendarNotificationTrigger(dateMatching: DateComponents(calendar: Calendar.current, timeZone: Calendar.current.timeZone, year: 2019, month: 1, day: 14, hour: 11, minute: 55, repeats: true )
let request = UNNotificationRequest(identifier: "identifier", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
You can create (schedule) only 64 local notifications
Upvotes: 0