Quick actions 3d touch to open viewcontroller

160 Views Asked by At

I am trying to get the 3d touch quick action to work, I have this code below.

I do get a print saying it was pressed but it doesn't go to the view controller I want.

func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {

            if shortcutItem.type == "LiveFeed" {
                print("Tony: We got to live view")

                guard let navVC = window?.rootViewController as? UINavigationController else { return }
                let storyBoard: UIStoryboard = UIStoryboard(name: "LiveFeed", bundle: nil)
                if #available(iOS 11.0, *) {
                    let composeViewController = storyBoard.instantiateViewController(withIdentifier: "LiveFeedMain") as! LiveFeedMain

                    navVC.pushViewController(composeViewController, animated: false)
                } else {
                    // Fallback on earlier versions
                }

            }
        }

I have this in the appDelegate

0

There are 0 best solutions below