Expert Interpretation: WatchKit Application Essentials

Expert Interpretation: WatchKit Application Essentials

[[152797]]

WatchKit App Architecture

A WatchKit application is an executable file that runs on the Apple Watch. It includes the storyboard and the resource files needed to render the screen.

WatchKit extensions are executable files that run on the iPhone, including logic code for managing the application interface and handling user interaction operations.

For the program interface to work properly, these two parts need to work together. The typical steps for a user to interact with an application are as follows:

The user interacts with the WatchKit app.

The WatchKit app analyzes the interactions and selects the storyboard that will be managed.

WatchKit communicates with the iPhone to run WatchKit extensions.

The WatchKit extension initializes and creates the objects needed to make them available to the WatchKit app storyboard.

The Storyboard generates a scene based on the objects created by the WatchKit extension and displays it on the Apple Watch.

The WatchKit app and WatchKit will share some information until the user stops using the WatchKit app, at which point iOS will put the WatchKit extension to sleep until new user interaction.

The following diagram illustrates this process:

An important concept in the above diagram is the way the storyboard responds to user actions and configures the screen content to be displayed. This is thanks to the interface controller object (an instance of WKInterfaceController), which is equivalent to the view controller in iOS.

Unlike the view controller, the interface controller does not manage the actual view on the screen. WatchKit handles the view in a transparent way. Generally, a WatchKit application will have multiple interface controllers to display different data types, but only one is displayed at a time.

WatchKit App Lifecycle

There are three ways to launch a WatchKit application:

The user taps an icon on the Apple Watch Home screen.

A user's glance interaction with an application.

The user interacts with the notification.

Each of the above methods will initialize the WatchKit application and the WatchKit extension. Depending on the different startup methods above, WatchKit will use the corresponding storyboard to load the scene and request the WatchKit extension to initialize the corresponding interface controller.

The following diagram illustrates the process:

As shown in the figure, in the user interface, the interface controller object manages the relevant interactions. When the user interacts with the application on the Apple Watch, the WatchKit extension will run. Once the user stops interacting or exits from the program, iOS will close the current interface controller and hibernate the extension. This interaction between the user and the Apple Watch is very simple. The interface controller should be lightweight and perform tasks quickly.

The following diagram illustrates the process:

<<:  watchOS 2 development tips that iOS developers should not miss

>>:  How WeChat makes 44 yuan per user

Recommend

How do you plan a successful event and ensure that expectations are met?

A good product may not be known to anyone. After ...

The "Quiet Night Thoughts" you recited was never seen by Li Bai

Recently, the movie "30,000 Miles from Chang...

Coffee is not recommended for these people!

For better work Every weekday morning I'll ha...

Kuaishou advertising process and conversion rate improvement techniques!

Kuaishou - "Record the world, record you&quo...

iOS AFNetworking framework HTTPS request configuration

[Quoted from IamOkay's blog] Under Apple'...

What's special about Microsoft Edge browser?

When Windows 10 arrives, the default browser will...

When the APP gold rush fades away, what will be the next era of wildflowers?

Many of the apps in your phone are rusty, right? ...

Analysis of Didi Qingju Bike User Growth System!

The “last mile” of public transportation is the m...

There are some rules for eating salt! Is iodized salt suitable for you?

This is the 4798th article of Da Yi Xiao Hu Iodin...

A collection of 10 classic cases of growth hacking, including To C and To B

Since Sean Ellis proposed the concept of Growth H...