Skip to content

Open app in specific view when user taps on push notification with iOS Swift

Notifications You must be signed in to change notification settings

mariohercules/ios-notification

Repository files navigation

Open app in specific view when user taps on push notification with iOS Swift

The file 'GoogleService-Info.plist' needs to be generated on Firebase site to compile this project.

[AppDelegate.swift]

       
    func navigateToView() {
        
        let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
        
        for child in (self.window?.rootViewController?.childViewControllers)! {
            
            if child.restorationIdentifier == "Three" {
                
                let tabbarcontroller = self.window?.rootViewController as! MainTabViewController
                
                // Select TabBarItem with Index = 2
                tabbarcontroller.selectedIndex = 2
                
                let listTableViewController = (child.childViewControllers[0]) as! ListTableViewController
                let booksTableViewController = (storyboard.instantiateViewController(withIdentifier: "Four")) as! BooksTableViewController
                
                listTableViewController.navigationController?.pushViewController(booksTableViewController, animated: true)
            }
        }
        
    }

IOS App ViewTransition

GitHub Logo

Main.Storyboard

GitHub Logo

About

Open app in specific view when user taps on push notification with iOS Swift

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published