IOS development: WatchKit application highlights

Source: Internet
Author: User
Tags home screen

IOS development: WatchKit application highlights

WatchKit application architecture

The WatchKit application is an executable file running on Apple Watch. It includes the storyboard and the resource files required for rendering the screen.

The WatchKit extension is an executable file running on the iPhone. It includes the logic code for managing the application interface and handling user interaction operations.

These two parts need to be run together for the normal use of the program interface. Typical steps for user-to-application interaction are as follows:

The user interacts with the WatchKit application.

The WatchKit application analyzes the interaction and selects the storyboard to be managed.

WatchKit communicates with the iPhone to run the WatchKit extension.

The WatchKit extension initializes and creates the object that needs to be provided to the WatchKit application storyboard.

Storyboard generates scene Based on the objects created by WatchKit extension and displays it in Apple Watch.

The WatchKit application and WatchKit will share some information until the user stops using the WatchKit application. In this case, iOS will sleep the WatchKit extension until new user interactions exist.

The figure below demonstrates the process:

Storyboard responds to user operations and configures the screen content to be displayed. This is due to the interface controller object (WKInterfaceController instance), which is equivalent to the view controller in iOS.

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

WatchKit application Lifecycle

There are three ways to start a WatchKit application:

Click the icon on the Apple Watch home screen.

The glance between the user and the application.

Interaction between users and notifications.

In each of the above methods, the WatchKit application and the WatchKit extension will be initialized. Based on the preceding startup methods, WatchKit loads scene using the corresponding storyboard and requests the WatchKit extension to initialize the corresponding interface controller.

The following figure demonstrates the related process:

Interface controller objects manage Related interactions on the user interface. When a user interacts with an application on Apple Watch, The WatchKit extension runs. Once the user stops interaction or exits from the program, iOS will disable the current interface controller and sleep the extension. Between users and Apple Watch, this interaction method is very simple. interface controller should be lightweight and fast to execute tasks.

The following figure demonstrates the related process:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.