Open ErAshu opened 2 years ago
I want to set a repeat Local notification from date. For Example:
StartDate: 26-July-2022
Todays Date: 23-July-2022
I am stuck here. I want to set a repeat Local notification from date.
Please have a look to my Notification function:
func scheduleLocalNotification(date: Date) { var calendar = Calendar.current calendar.timeZone = TimeZone.current let content = UNMutableNotificationContent() // Configure Notification Content content.title = "REMINDER For Yoga" content.body = "Hi! Take ready for Daily Yoga Class." // Set Category Identifier content.categoryIdentifier = "Yoga_872" var components = calendar.dateComponents([.hour, .minute], from: date) let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true) // Create Notification Request let identifier = "Yoga_Class(222)" let notificationRequest = UNNotificationRequest(identifier: identifier, content: content, trigger: trigger) // Add Request to User Notification Center UNUserNotificationCenter.current().add(notificationRequest) { (error) in if let error = error { print("Add Notification Request Error: (\(error), \(error.localizedDescription))") } } }
This function fire notification from Today. I want to this from 26th July 2022.
I want to set a repeat Local notification from date. For Example:
StartDate: 26-July-2022
Todays Date: 23-July-2022
I am stuck here. I want to set a repeat Local notification from date.
Please have a look to my Notification function:
This function fire notification from Today. I want to this from 26th July 2022.