0

Relatively new to Swift so sorry if this is obvious. Trying to create quick action links to open different tab views:

Quick Action Links

When ever I try to open the action with this code though it always goes to the first quick action 'featured'??

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

    if shortcutItem.type == "matthewfrankland.RonaldYule.contacts"{
        let sb = UIStoryboard(name: "Main", bundle: nil)
        let vc = sb.instantiateViewController(withIdentifier: "contacts") as! Contact
        window?.rootViewController?.addChildViewController(vc)
    }

    if shortcutItem.type == "matthewfrankland.RonaldYule.allvideos" {
        let sb = UIStoryboard(name: "Main", bundle: nil)
        let vc = sb.instantiateViewController(withIdentifier: "allVideos") as! AllVideos
        window?.rootViewController?.addChildViewController(vc)
    }

    if shortcutItem.type == "matthewfrankland.RonaldYule.featured"{
        let sb = UIStoryboard(name: "Main", bundle: nil)
        let vc = sb.instantiateViewController(withIdentifier: "featured") as! Featured
        window?.rootViewController?.addChildViewController(vc)
    }
}

0 Answers0