watchos-2wkinterfacetable

WKInterfaceTable pull to refresh


Is it possible to create pull to refresh action in WKInterfaceTable in watch os 2?

There is one question but its related to watch os 1.

WatchKit pull to refresh


Solution

  • Short Answer:

    No, it's not possible.


    Long Answer:

    All WKInterface Objects are just proxy objects that allows you to send queries to real UI Object. So basically they are not treditional UI Objects.

    Connections between real UIs and WKInterface objects are managed by watchOS. What if some WKInterfaceController got deactivated, the connections in it will be disconnected also. In this state, you can't send queries anymore.

    You may know that there are two bundles for watch Apps, one takes storyboard and icons, the other one is extension bundle. With sand-box concept, your code(in extension) can't access UI(storyboard bundle sided) directly. The only way to interact is using Interface Builder outlets and sent action.

    It(Remote-UI concepts) makes sense for watchOS1 since all the code runs on iPhone. However with some reason, WatchOS2 App also use same strategy. With this restriction, You can't write code that react user interaction to real UI Objects directly likes iOS apps. As I told earlier, You can use pre-defined sent action only.

    Since Xcode Interface Builder doesn't provide sent action likes did scroll, You can't write code that react pull down.