title: Display a view after receiving APNS with SwiftUI
body: <p>I want to show a view, after my App received an APNS-Push Notification. I'm using SwiftUI. I followed this tutorial (<a href="https://blckbirds.com/post/how-to-navnigate-between-views-in-swiftui-by-using-an-environmentobject/" rel="nofollow noreferrer">https://blckbirds.com/post/how-to-navnigate-between-views-in-swiftui-by-using-an-environmentobject/</a>) to create a motherView and a ViewRouter.</p>
  
  <p>MotherView looks like that:</p>
  
  <pre><code>struct MotherView: View {
  
  //    MARK: - Properties
      @EnvironmentObject var viewRouter: ViewRouter
      @State private var isMenuVisible: Bool = false
  
      var body: some View {
          VStack {
              if viewRouter.currentPage == Constants.Views.login {
                  Login_SwiftUIView()
              } else if viewRouter.currentPage == Constants.Views.main {
                  MainView(withMenu: $isMenuVisible)
              } else if viewRouter.currentPage == Constants.Views.menu {
                  Menu_SwiftUI(withMenu: $isMenuVisible)
              } else if viewRouter.currentPage == Constants.Views.push {
                  PushView()
              }
          }
      }
  }
  </code></pre>
  
  <p>ViewRouter is a ObservableObjectClass</p>
  
  <pre><code>class ViewRouter: ObservableObject {
  
      let objectWillChange = PassthroughSubject&lt;ViewRouter,Never&gt;()
  
      var currentPage: Constants.Views = Constants.Views.login {
          didSet {
              objectWillChange.send(self)
          }
      }
  }
  </code></pre>
  
  <p>The AppDelegate calls this function, after receiving a Push-Notification:</p>
  
  <pre><code>func presentView(with pushNotification: [String: AnyObject]) {
      //Here I want to set the viewRouter.currentPage = Constants.View.push
  }
  </code></pre>
  
  <p>What would be your suggestions to solve this problem?</p>