Upravit

Sdílet prostřednictvím


WatchKit Namespace

Framework for programming the Apple Watch.

Classes

WKAccessibility

Extension methods for WKInterfaceController that improve accessibility.

WKAccessibilityImageRegion

A portion of an image that should be made separately available to assistive applications.

WKErrorCodeExtensions

Extension methods for the WatchKit.WKErrorCode enumeration.

WKInterfaceButton

A watch control that acts as a button.

WKInterfaceController

Base class for controller objects in Watch Extension projects.

WKInterfaceDate

A watch control that displays the date and time.

WKInterfaceDevice

Represents the watch. Use the singleton object CurrentDevice.

WKInterfaceGroup

A container for watch controls.

WKInterfaceImage

A watch control that displays an image.

WKInterfaceLabel

A watch control that displays text.

WKInterfaceMap

A watch control that displays an Apple-provided map.

WKInterfaceObject

Base class for Watch controls.

WKInterfaceObject.Notifications
WKInterfaceSeparator

A watch control that displays a line for separating controls.

WKInterfaceSlider

A watch control that allows the user to set a value within a range.

WKInterfaceSwitch

A watch control that allows the user to manipulate a binary value.

WKInterfaceTable

A watch control that provides a single-column table.

WKInterfaceTimer

A watch control that displays a countdown timer.

WKPresentMediaPlayerResult

Contains the result of presenting a media player.

WKUserNotificationInterfaceController

A sub-class of WKInterfaceController that adds methods that are called when a notification arrives.

Interfaces

IWKImageAnimatable

Interface representing the required methods (if any) of the protocol IWKImageAnimatable.

Enums

WKErrorCode

Enumerates error codes relevant to Watch Kit programming.

WKInterfaceMapPinColor

Enumeration of colors that can be used by pins on a WKInterfaceMap.

WKMenuItemIcon

Enumerates standard icons for use in Watch context menus.

WKTextInputMode

Enumeration of restrictions on text input (constraints on emoji).

WKUserNotificationInterfaceType

Enumerates notificaion types for use with the DidReceiveLocalNotification(UILocalNotification, Action<WKUserNotificationInterfaceType>) and DidReceiveRemoteNotification(NSDictionary, Action<WKUserNotificationInterfaceType>) completion handlers.

Remarks

Watch Kit is Apple's framework for programming the Apple Watch. Watch Kit solutions are comprised of 3 Xamarin projects:

ProjectPurpose
Parent App The Parent App is a normal iPhone project that bundles the other projects and can be used for tutorials, administrative needs, and background processing. It runs in a separate sandbox than the Watch Extension and it is possible for the user to run the Watch App / Extension without ever opening the Parent App.
Watch Extension The Watch Extension runs on a connected iPhone and holds the program logic for the Watch App itself.
Watch App The Watch App is a small project that runs on the phone itself. Generally, the Watch App only consists of a Storyboard file, small resources, and links to files in the Watch Extension.

Installation, structure, and general programming information about Watch Kit can be found in Xamarin's Watch Kit Programming Guide.

Programming Watch Extensions is heavily based on reacting to lifecycle methods of the WKInterfaceController. Application developers create subtypes of WKInterfaceController and override the Awake, M:WatchKit.WKInterfaceController.WillActivate*, and M:WatchKit.WKInterfaceController.DidDeactivate* methods.

See also