Whenever the user gets a notification and they click it, they should be taken to that specific tab. For instance, when a user gets a message and they open the notification, the app should open up but to the messages tab. Think of twitter & dm's. With my project, Im trying to implement something very similar. In the appdelegate and notificationReceived (OneSignal for Push notifications), I've attempted to do so by this:
let sb: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let messageNavigationController: UINavigationController = sb.instantiateViewController(withIdentifier: "MessagesNav") as! UINavigationController
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = messageNavigationController
self.window?.makeKeyAndVisible()
But nothing happens. Whenever a user receives a notification, the app just opens up one the main tab (tab 0). What am i doing incorrectly?