Search code examples
swiftwatchkitgesture

Use menu item for open another interface controller


I'm trying to add the possibility to use Force Touch for opening another Interface Controller on my Apple Watch. Is it possible to use the Menu object through the Menu Item for launching another Interface Controller? And if yes, how can I? Thank you!


Solution

  • Yes, it is possible. You need to create an IBAction for your Menu Item and call the desired navigation function inside that IBAction. I will show you code for using presentController, but you can use any other available navigation function from WatchKit.

    @IBAction func presentOtherInterfaceController() {
        self.presentController(withName: "MyOtherInterfaceController", context: nil)
    }