How does one send notification in vision os? I seem to not be able to find any information about notifications in vision os.
I have a window which after some time it should alert the user to look at it and I thought notification is a good idea (or is there some other way I could do that?) but I can't get it to work.
I have the permission requested and granted. Am I doing something wrong? Is vision os not supporting notifications? I can't find anything related to this. Did anyone manage to send a notification and if yes, how?
I tried the following code and it does not do anything:
let content = UNMutableNotificationContent()
content.title = "Feed the cat"
content.body = "It looks hungry"
content.sound = UNNotificationSound.default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
let notificationCenter = UNUserNotificationCenter.current()
notificationCenter.add(request)

You are missing the
delegateand telling theUNUserNotificationCenterhow to present the notification in the foreground.The rest of the
managerwould look something like.Note that you should create the
managerat the very top of your app withand inject it into the app with
So you can access it everywhere with
It is important that the
delegateis stable so the app doesn't miss notifications.Here is a sample
View