Disable local notifications for one day if user completes a task

Hello

How do I disable a notification for a day if it is set within one hour and the user has completed a task. This is my function to set up local notifications:

import UserNotifications

func scheduleNotifications(date: Date, identfier: String) {
    
    let content = UNMutableNotificationContent()
    content.title = "App name"
    content.body = "Message."
    content.sound = .default
    content.userInfo = ["Hour": timeFormatter.string(from: date)]
    
    var dateComponents = DateComponents()
    dateComponents.hour = Int(hourFormatter.string(from: date)) ?? 0
    dateComponents.minute = Int(minuteFormatter.string(from: date)) ?? 0
    
    let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)
    let request = UNNotificationRequest(identifier: identfier, content: content, trigger: trigger)
    
    UNUserNotificationCenter.current().add(request)

    
}

Disable local notifications for one day if user completes a task
 
 
Q