Perform action pressing notification Swift
<p>I'm using Firebase notification in order to send and receive RemoteNotification.</p>

<p>When I receive a notification, I receive also an ID that let me to identify a specifically "post".</p>

<p>Now, when I click on notification, I need that app to open a viewController passing it the received ID, in order to start a method (in <code>viewDidLoad()</code>) that load "post" informations.</p>

<p>this is the code of notification:</p>

<pre><code>    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                 fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -&gt; Void) {
    // Print message ID.
    print("Message ID: \(userInfo["gcm.message_id"]!)")

    let aps = userInfo["aps"] as! NSDictionary
    let body_notifica = aps["alert"]! as! NSDictionary
    let titolo_notifica = body_notifica["title"]! as! String
    let testo_notifica = body_notifica["body"]! as! String

    let id_lavoro = userInfo["id_lavoro"]! //THIS IS THE ID I NEED TO PASS TO VIEW CONTROLLER

    if application.applicationState == UIApplicationState.inactive || application.applicationState == UIApplicationState.background{
        let viewController = self.window!.rootViewController!.storyboard!.instantiateViewController(withIdentifier: "annuncio_view_controler")
        viewController.performSegue(withIdentifier: "a", sender: &lt;#T##Any?#&gt;)
    }


    let banner = Banner(title: titolo_notifica, subtitle: testo_notifica, image: UIImage(named: "Info"), backgroundColor: UIColor(red:0.0/255.0, green:0.0/255.0, blue:0.0/255.0, alpha:0.5))
    banner.dismissesOnTap = true
    banner.show(duration: 3.0)

    print(userInfo)

}
</code></pre>

<p>thank you guys!</p>