Unable to post local notifications on Swift 6

I used the following class to post local notifications:

class LocalNotification: NSObject, UNUserNotificationCenterDelegate{
    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async ->  UNNotificationPresentationOptions{
        print("torna notification")
        return [.sound, .badge, .banner]
    }
    
    func localNotification(_ title:String, message:String,  sound:UNNotificationSound?, badge:Int?, interval:TimeInterval, userInfo: [AnyHashable : Any]?, category:UNNotificationCategory?=nil){
        let content = UNMutableNotificationContent()
        content.title = NSString.localizedUserNotificationString(forKey: title, arguments: nil)
        content.body = NSString.localizedUserNotificationString(forKey: message, arguments: nil)
        content.sound=sound
        let ti = interval * 60
        let seconds = ti.second
        let minutes = ti.minute
        let hours = ti.hour
        //let ms = Int((interval.truncatingRemainder(dividingBy: 1)) * 1000)
        var dateInfo = DateComponents()
        dateInfo.hour=hours
        dateInfo.minute=minutes
        dateInfo.second=seconds
        let trigger = UNCalendarNotificationTrigger(dateMatching: dateInfo, repeats: false)
        let request = UNNotificationRequest(identifier: message, content: content, trigger: trigger)
        let center = UNUserNotificationCenter.current()
        center.delegate = self
        center.add(request) { (error : Error?) in
            if let theError = error {
                print(theError.localizedDescription)
            }
        }
    }
}

But still function:

UNUserNotificationCenterDelegate{
    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async 

is never called and more importantly no notification is delivered, either sound or banner.

Last week you posted saying your notifications were making sound but no banner. You should investigate what you changed since then to make the situation worse.

We don't believe this has anything to do with Swift 6, but there is a problem in your code. Last week we asked you to check the parameters to your `localNotification()' function. That recommendation still stands.

Presently not even the sound is played. Frankly I do not understand what the parameters of the function have to do with the notification not being sent. At any rate now I took away the inheritance and turned the class into a struct, to see if anything would change.

Unable to post local notifications on Swift 6
 
 
Q