Guest User

Untitled

a guest
Feb 14th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. for ind in 0...countNum
  2. {
  3. guard let fireDate = alarm.fireDate else { return }
  4. print(fireDate)
  5. let date = fireDate.addingTimeInterval((1.0*Double(ind)) * 60.0)
  6. print(date)
  7. let weekday = Calendar.current.component(.weekday, from: Date())
  8. print(weekday)
  9.  
  10. let triggerDate = Calendar.current.dateComponents([.year, .month, .weekday, .hour, .minute, .second], from: date)
  11. DispatchQueue.main.async
  12. {
  13. print(triggerDate)
  14. let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDate, repeats: true)
  15. let request = UNNotificationRequest(identifier: "(alarm.uuid)(ind)", content: notificationContent, trigger: trigger)
  16. UNUserNotificationCenter.current().add(request)
  17. {
  18. (error) in
  19. if let error = error
  20. {
  21. print("Unable to add notification request, (error.localizedDescription)")
  22. }
  23. }
  24. }
  25.  
  26. }
Add Comment
Please, Sign In to add comment