There are many updates in WatchKit of watchOS 2. I will talk about five new enhancements. I found an issue about watchOS 2 beta 3 and beta 4. This issue is that only apps written in Objective C can run on a real Apple watch and apps written in Swift cannot run on a real device.
Now you can use animateWithDuration function of WKInterfaceController to animate some properties of objects.
Developers can manipulate Taptic engine on the Apple watch. The API is quite simple. Only one function (playHaptic) can be used, and just 9 types Taptic can be played.
WatchConnectivity framework is used to communicate between iPhone and Apple Watch. The most important class is WCSession. The delegate is used to receive messages from a counterpart.
This is an example to send a message.
This is an example to receive a message.
WKInterfacePicker is a new control in watchOS 2 and its value can be changed by spinning the digital crown. “focusForCrownInput” is the method to focus this control.
The below is the simplest example of WKInterfacePicker.
The important class of complication is CLKComplicationDataSource class. Developers need to create a class to implement this delegate. There are 5 families of complications: ModularSmall, ModularLarge, UtilitarianSmall, UtilitarianLarge, CircularSmall.