Getting Started with Apple Watch apps for existing iPhone apps
After developing my first Watch app successfully I thought of sharing the experience as it will be helpful for the developers out there who are planning to develop their Watch version for existing apps or all new apps. This is a simple post describing in the easiest way how to develop and debug Watch apps when you have an existing iOS app out on AppStore.
- Xcode 6.3 or higher
- iOS 8.3 installed devices or Simulators
- Apple Watch or Watch Simulator (will be in Xcode 6.3)
In Xcode, navigate to File ->New ->Target… and select the iOS ->Apple Watch ->Watch App template.
Choose Next and keep Include Notification Scene and Include Glance Sceneunchecked for now. And Finish
After finishing Xcode will ask you to Activate “WatchKit App” scheme? Choose Activate.
You will notice it will add WatchKit Extension and WatchKit App to your target
Here is the target structure of WatchKit app
To understand the architecture of iPhone app and Watch app. This figure explains well from developer apple.
When you are done with steps I would suggest to go through your project structure and understand InterfaceControllers and Interface.storyboard.
You may be familiar with AutoLayouts in iPhone / iPad storyboards. As there is limited real-estate on Watch, the positioning and sizing is limited in Interface.storyboards. Most of the time you will use Position and Size in Attributes Inspector for any UI object. It is designed similar to Size classes where you can choose separate values for 42 and 38mm Watch sizes.
Play around with Interface.Storyboard and add some labels and images.
Building and Running
For running the Watch app we need to select WatchKit App and then run the project. When the simulator start go to Hardware -> External Display and choose Apple Watch any size.
Your Watch app will run on simulator and will look like this.
There is a lot we can do for WatchKit but it unfortunately goes beyond the scope of this post. I will write a new post soon to explain advancements on WatchKit.