Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for ind in 0...countNum
- {
- guard let fireDate = alarm.fireDate else { return }
- print(fireDate)
- let date = fireDate.addingTimeInterval((1.0*Double(ind)) * 60.0)
- print(date)
- let weekday = Calendar.current.component(.weekday, from: Date())
- print(weekday)
- let triggerDate = Calendar.current.dateComponents([.year, .month, .weekday, .hour, .minute, .second], from: date)
- DispatchQueue.main.async
- {
- print(triggerDate)
- let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDate, repeats: true)
- let request = UNNotificationRequest(identifier: "(alarm.uuid)(ind)", content: notificationContent, trigger: trigger)
- UNUserNotificationCenter.current().add(request)
- {
- (error) in
- if let error = error
- {
- print("Unable to add notification request, (error.localizedDescription)")
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment