Apple watch:watchkit Application Essentials

Source: Internet
Author: User
<span id="Label3"></p>Apple watch:watchkit Application Essentials<p><p></p></p><p><p>This article was translated from: Apple Watch:watchkit App Essentials</p></p>WatchKit Application Architecture<p><p>The previous article briefly describes watchkit, which is made up of two parts when developing an Apple Watch application: watchkit applications and WatchKit Extensions.</p></p> <ul> <ul> <li><code>WatchKit 应用程序</code>is an executable file that runs in Apple Watch. It includes the resource files required to storyboard and render the Screen.</li> <li><code>WatchKit 扩展</code>is the executable file that runs on the IPHONE. This includes logic code to manage the application interface, as well as handling user Interaction.</li> </ul> </ul><p><p>For the normal use of the program interface, these two parts need to be run Together. The typical steps for user interaction with the application are as Follows:</p></p> <ol> <ol> <li>The user interacts with the WatchKit Application.</li> <li>The WatchKit application parses the interaction and selects the storyboard to be Managed.</li> <li>WatchKit communicates with the IPhone to run the WatchKit Extension.</li> <li>The WatchKit extension initializes and creates objects that need to be supplied to the WatchKit application Storyboard.</li> <li>Storyboard creates a scene based on the objects created by the WatchKit extension and displays it to Apple Watch.</li> <li>WatchKit applications and WatchKit will share some information until the user stops using the WatchKit Application. At this point, IOS will allow WatchKit to hibernate until new user interaction Occurs.</li> </ol> </ol><p><p>The following diagram illustrates this process:</p></p><p><p></p></p><p><p>An important concept in storyboard is how to respond to user actions and configure the screen content that needs to be displayed. This is attributed <code>interface controller</code> to the object ( <code>WKInterfaceController</code> the instance), which is equivalent to the view controller in iOS.</p></p><p><p>Unlike the view controller, interface controller does not manage the actual view,watchkit on the screen in a transparent way to handle the VIEW. In general, a WatchKit application will have multiple interface controllers to display different data types, but only one at a Time.</p></p>WatchKit the life cycle of an application<p><p>There are 3 ways to start a watchkit application:</p></p> <ul> <ul> <li>The user clicks the icon on the Apple Watch home Screen.</li> <li>The user interacts with the glance of the Application.</li> <li>The user interacts with the Notification.</li> </ul> </ul><p><p>Each of the above methods initializes the WatchKit application and the WatchKit Extension. Depending on the different boot modes above, WatchKit will load the scene with the corresponding storyboard and request the WatchKit extension to initialize the corresponding interface Controller.</p></p><p><p>The following diagram illustrates the related process:</p></p><p><p></p></p><p><p>, in the user interface, the interface controller object manages the related Interactions. The WatchKit extension runs when the user interacts with an application on Apple Watch. Once the user stops interacting or exits from the program, IOS will close the current interface controller and hibernate the Extension. This interaction is very concise between the user and Apple Watch, and the interface controller should be lightweight and quick to perform tasks.</p></p><p><p>The following diagram illustrates the related process:</p></p><p><p></p></p><p><p></p></p><p><p>Apple watch:watchkit Application Essentials</p></p></span>

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.