Posts

Showing posts from December, 2016

How to show activity indicator in watch kit

To show loading indicator in watch kit without using any third party, follow the below steps:- Download the images here and add them in watch kit at xcassets (MyPWatch WatchKit App -> Assets.xcassets)Add the WKInterfaceImage (named imageLoading) to your 
WKInterfaceController Show loading indicator as belowself.imageLoading.setImageNamed("Activity") self.imageLoading.startAnimatingWithImages(in: NSMakeRange(1, 15), duration: 3.0, repeatCount: 0) To hide the indicator, do as below:- self.imageLoading.stopAnimating() self.imageLoading.setHidden(true)

Passing data to Apple Watch app from iPhone

I made a utility for transferring the data between iWatch and iPhone. This is done using the WatchConnectivity framework which is available in watch OS 2 and later.General steps to perform. Although all steps are written in the working sample code. Create the WCSessionImplement the WCSessionDelegate methods. WKInterfaceController will receive the context dictionary in one of the delegate method.In the UIViewController, Create the WCSession. When ever you want to share information to watch, then update the ApplicationContext tryWatchData.sharedInstance.session.updateApplicationContext(["message" : message])



Full working code is available at https://www.dropbox.com/s/53ddbxhiaomdjt9/MyPWatch.zip?dl=0