Hi, I'm working on my first app in 100% SwiftUI.
The app generates a number of different types of user notification (i.e. local notifications) via UNUserNotificationCenter.
I've figured out the creation of notifications and this is working well. I've created a UserNotificationManager class as an ObservableObject which handles creation / scheduling of / changes to the notifications based on state variables in the app's various views.
The next steps are:
(a) depending on the type of notification, to take the user back to the most appropriate place in the app when they tap (i.e. to open a specific view)
(b) to incorporate actions in some of the notifications, so users can update selected data in the app directly from the notification
However, it isn't clear how to do this in SwiftUI.
I can find tutorials that work in Swift and UIKit assuming that a ViewController handles notification responses and conforms to the UNUserNotificationCenterDelegate protocol, but I can't find a way to make it work in SwiftUI. I've tried some things with AppDelegate (which I've set up to conform to the above protocol) and that's enabled me to show the notifications when the app is in the foreground, but I can't get it do anything beyond this. I've also tried to setup my UserNotificationManager class to confirm to the protocol but this requires creation of a load of protocol stubs and it isn't clear how to use them.
Can anyone offer some suggestions?