Skip to Content
iOS 10 Swift Programming Cookbook
book

iOS 10 Swift Programming Cookbook

by Vandad Nahavandipoor
December 2016
Intermediate to advanced content levelIntermediate to advanced
456 pages
8h 46m
English
O'Reilly Media, Inc.
Content preview from iOS 10 Swift Programming Cookbook

Chapter 7. Apple Watch

Version 3 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 3 target to your app. So go to Xcode and create a new Target. On the new window, on the lefthand side, under the watchOS category, choose WatchKit App (see Figure 7-1) and proceed to the next stage.

Figure 7-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 7-2).

Figure 7-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.

7.1 Downloading Files onto the Apple Watch

Problem

You want to be able to download files from your watch app directly without needing to communicate your intentions to the paired iOS device.

Solution

Use URLSession as you would on a phone, but with more consideration toward ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

iOS 11 Swift Programming Cookbook

iOS 11 Swift Programming Cookbook

Vandad Nahavandipoor
iOS 7 Programming Cookbook

iOS 7 Programming Cookbook

Vandad Nahavandipoor

Publisher Resources

ISBN: 9781491966426Errata PageSupplemental Content