I'm currently trying to add 3D touch to my app. I've already achieved that my app shows the UIApplicationShortcutItems
, but now I'm having trouble assigning an action to them.
This is my current code:
func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void)
{
let homeVC = HomeVC()
if shortcutItem.type == "com.appName.actionType1"
{
homeVC.tabBarController?.selectedIndex = 1
}
if shortcutItem.type == "com.appName.actionType2"
{
homeVC.tabBarController?.selectedIndex = 2
}
}
It wouldn't be so hard to do this, but the problem I'm having is that my HomeVC
isn't the rootViewController
.
Any suggestions? I'd really appreciate it.