John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 987 forks source link

Push to specific view controller from push notification #774

Open yonathansteam opened 6 years ago

yonathansteam commented 6 years ago

How to push specific view controller from push notification in SWRevealViewController ? For now i can only set to homeVC how to push to anotherVC ?

//Handle payload data from push notification

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { let storyboard = UIStoryboard(name: "Main", bundle: nil) let sw = storyboard.instantiateViewController(withIdentifier: "revealControllerStoryboard") as! SWRevealViewController self.window?.rootViewController = sw }

Saravana181187 commented 6 years ago

Can you try this.. It will helps you.

let storyboard = UIStoryboard(name: "Main", bundle: nil) let sw = storyboard.instantiateViewController(withIdentifier: "RevealViewController") as! SWRevealViewController self.window?.rootViewController = sw

        let destinationController = storyboard.instantiateViewController(withIdentifier: "NotificationViewController") as! NotificationViewController
        let navigationController = UINavigationController(rootViewController: destinationController)
        sw.pushFrontViewController(navigationController, animated: true)
yonathansteam commented 6 years ago

i already tried that not working still go to home if i push to specific VC

ManishaQw commented 6 years ago

Can you try this.. It will helps you.

let storyboard = UIStoryboard(name: "Main", bundle: nil) let sw = storyboard.instantiateViewController(withIdentifier: "RevealViewController") as! SWRevealViewController self.window?.rootViewController = sw

        let destinationController = storyboard.instantiateViewController(withIdentifier: "NotificationViewController") as! NotificationViewController
        let navigationController = UINavigationController(rootViewController: destinationController)
        sw.pushFrontViewController(navigationController, animated: true)

Thank's this worked for me.