O'Reilly logo

iOS 9 Swift Programming Cookbook by Vandad Nahavandipoor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Apple Watch

Version 2 of watchOS gives us developers a lot more control and brings cool features to the users as well. Now that we can download files directly and get access to sensors directly on the watch, the users will benefit.

In this chapter, I am going to assume that you have a simple iOS application in Xcode already created and you want to add a watchOS 2 target to your app. So go to Xcode and create a new Target. On the new window, on the left-hand side, under the watchOS category, choose WatchKit App (see Figure 2-1) and proceed to the next stage.

Figure 2-1. Adding a WatchKit App target to your main application

In the next stage, make sure that you have enabled complications (we’ll talk about it later) and the glance scene (see Figure 2-2).

Figure 2-2. Add a complication and a glance scene to your watch app

After you have created your watch extension, you want to be able to run it on the simulator. To do this, simply choose your app from the targets in Xcode and click the run button (see Figure 2-3).

Figure 2-3. A simple watch interface

2.1 Downloading Files onto the Apple Watch

Problem

You want to be able to download files from your watch app directly ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required