Search code examples
iosswiftseguewatchkitapple-watch

Load second app interface in a segue


Basically what I want to do is depicted in the image below:

However this only loads the middle and third interface, the first is hidden both from swiping onto and in the circle indicators at the bottom.

Segue depiction

I'd like to be able to load the second interface and swipe left for the first and swipe right for the third. Is there a way to achieve this?


Solution

  • Building my first Apple Watch app over here :)

    Looks like there is a concept of UINavigationController-ish behaviour built into the WKInterfacesController.

    Take a look at: pushControllerWithName(_:context:)

    And from some docs I found here:

    Hierarchical. This style is suited for apps with more complex data models or apps whose data is more hierarchical. A hierarchical interface always starts with a single root interface controller. In that interface controller, you provide controls that, when tapped, push new interface controllers onto the screen.

    EDIT: Looking into this some more. WatchKit is currently very limited by the looks.

    The best solutions I could come up with was to add the three InterfaceController, with segues is between. Left -> Main -> Right.

    enter image description here

    Then assign a custom SKInterfaceController for Main:

    class InterfaceController: WKInterfaceController {  
      override init() {
        super.init()
        becomeCurrentPage()
      } 
    }
    

    This creates an annoying animation in the beginning where you will see "Left" on start and how "Main" is animated pushed in. I don't see any better way to do this at this early stage of WatchKit.