ios - Present a ViewController from the AppDelegate -


i have 3d force touch action set in info.plist. want when 3d action running presents view controller gave storyboard id , need in appdelegate.

i used performactionforshortcutitem function.

func application(_ application: uiapplication, performactionfor shortcutitem: uiapplicationshortcutitem, completionhandler: @escaping (bool) -> void) {     if let tabvc = self.window?.rootviewcontroller as? uitabbarcontroller {         if shortcutitem.type == "hausaufgaben" {             tabvc.selectedindex = 1             tabvc.performsegue(withidentifier: "gotohausaufgaben", sender: nil)         }         }         } 

func application(_ application: uiapplication, performactionfor shortcutitem: uiapplicationshortcutitem, completionhandler: @escaping (bool) -> void) {    if shortcutitem.type == "hausaufgaben" {       self.window = uiwindow(frame: uiscreen.main.bounds)       let storyboard = uistoryboard(name: "main", bundle: nil)       let initialviewcontroller = storyboard.instantiateviewcontroller(withidentifier: "your page identifier")       self.window?.rootviewcontroller = initialviewcontroller       self.window?.makekeyandvisible()    } } 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -