🅰Б
private func scheduleNotification(title: String, subTitle: String, body: String, addingTimeInterval: TimeInterval) {
//creating the notification content
let content = UNMutableNotificationContent()
//adding title, subtitle, body and badge
content.title = title
content.subtitle = subTitle
content.body = body
content.sound = UNNotificationSound.default
//getting the notification trigger
let date = selectedDate?.addingTimeInterval(addingTimeInterval).zeroSeconds
let triggerDate = Calendar.current.dateComponents([.year,.month,.day,.hour,.minute,.second,], from: date!)
let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDate, repeats: false)
//getting the notification request
let request = UNNotificationRequest(identifier: "forEvents", content: content, trigger: trigger)
//adding the notification to notification center
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
}