ios – Learn how to get Notifications whereas App is in Foreground with SwiftUI and new App Struct?


Context

My App makes use of SwiftUI with the brand new App Struct as a substitute of AppDelegate and utilises Native Notifications. Scheduling Notifications works completely positive when the App is within the background, nonetheless, it doesn’t work when the App is operating within the foreground.

I do know that you should utilize func userNotificationCenter(...) with AppDelegate to customize this behaviour, nonetheless, in my case, I take advantage of the brand new App Struct and don’t have any AppDelegate.


Code

struct MyApp: App {}

Query

  • How can I customise the Notification behaviour when the App is within the foreground whereas utilizing the brand new SwiftUI App Struct?
See also  ios - How do I get show the UITabController to point out above the tab bar?

Leave a Reply