ioswatchkitapple-watchwkinterfacecontroller

How to segue to the middle InterfaceController in Page Based Navigation on Apple Watch?


I am trying to build a similar flow to the Apple Watch Workout App where after you begin a workout you are presented with an InterfaceController showing the duration and you scan swipe left to see an additional InterfaceController or swipe right to end the workout etc. on another InterfaceController. However (below) I cannot swipe right to see the IC on the left to end the workout. How can I achieve this so that the user is placed in the 2nd IC of the navigation stack without a hack solution such as if I'm presented from the initial InterfaceController auto reload to IC #2?

enter image description here


Solution

  • Not sure if it's possible to do it in the storyboard as I was attempting, but figured out how to do exactly what I wanted via code:

        WKInterfaceController.reloadRootPageControllers(withNames: ["testIC1", "testIC2", "testIC3"],
                                                        contexts: [contextDictionary],
                                                        orientation: .horizontal,
                                                        pageIndex: 1)
    }