Skip to main content
main-content
Top

About this book

Program the Internet of Things with Swift and iOS is a detailed tutorial that will teach you how to build apps using Apple’s native APIs for the Internet of Things, including the Apple Watch, HomeKit, and Apple Pay. This is the second book by Ahmed Bakir (author of Beginning iOS Media App Development) and his team at devAtelier LLC, who have been involved in developing over 20 mobile projects.

Written like a code review, this book presents a detailed "how" and "why" for each topic, explaining Apple-specific design patterns as they come up and pulling lessons from other popular apps. To help you getting up and running quickly, each chapter is framed within a working project, allowing you to use the sample code directly in your apps.

The Internet of Things is not limited to Apple devices alone, so this book also explains how to interface with popular third-party hardware devices, such as the Fitbit and Raspberry Pi, and generic interfaces, like Restful API’s and HTTPS. The Internet of Things is waiting — be a part of it!

Table of Contents

Chapter 1. Building Your First Internet of Things App

Abstract
To help introduce you to the style of this book, your first project will be a very simple application that demonstrates several of the steps you will take when building an Internet of Things application: creating a project, including hardware-specific frameworks, retrieving data, and displaying it. For your first project, you will create an application that logs the user’s location using his phone’s GPS chip and displays it on a map. This app could be used to help him find his car if he has the tendency to forget where it is (like a certain author). Figure 1-1 shows the mock-up, indicating the major user interface (UI) components and the flow of the application. The application you will create will follow the guideline set by this mock-up closely.
Ahmed Bakir, Gheorghe Chesler, Manny de la Torriente

Chapter 4. Using Core Motion to Save Motion Data

Abstract
In the last chapter, you learned how to set up an application for HealthKit, Apple’s shared repository for health data, and query for specific health data types. In this chapter, you will learn how to use Core Motion to access live motion data from a user’s device, and how to save it back to HealthKit, where it will be accessible to all applications.
Ahmed Bakir, Gheorghe Chesler, Manny de la Torriente

Chapter 6. Building Your First watchOS App

Abstract
In late 2014, Apple replied to the vocal concerns of many of its critics and consumers by introducing a completely new “product category” — the Apple Watch. This came as a surprise to (almost) everyone, why would the most profitable computer company in history enter the smart watch market, a “fad” that had yet to achieve a killer app? Similarly, how would they address people’s bias as to how watches should look and work (they’ve only been around for a few thousand years)? And what would they do to make it an app platform?
Ahmed Bakir, Gheorghe Chesler, Manny de la Torriente

Chapter 8. Building a Stand-Alone watchOS App

Abstract
In this chapter, you will learn about one of the greatest attributes of watchOS 2: its capabilities that let you build an app that runs natively, even offline, without maintaining an active connection to your parent iOS app. So far, you have noticed that watchOS 2 apps share many design features with iOS apps, including interface controllers (view controllers), notifications, and delegation. With watchOS 1, you were limited to building “listener” apps, designed to respond to data manifests from a parent app; they were not intended to provide anything more than consumption. watchOS 2 bridges a huge gap because it allows you to build apps that not only are designed like iOS apps but also function like iOS apps.
Ahmed Bakir, Gheorghe Chesler, Manny de la Torriente

Chapter 12. Building an App That Interacts with a Raspberry Pi

Abstract
In this chapter, we will write an app that communicates with a Raspberry Pi device on the local Wi-Fi network that allows us to flip the lights on and off on a custom module with LEDs. This might not seem like a significant accomplishment, but keep in mind that just as you can flip on and off some LED lights, you can control any other connected devices in a similar fashion.
Ahmed Bakir, Gheorghe Chesler, Manny de la Torriente

Chapter 14. Using Touch ID for Local Authentication

Abstract
Ever-increasing rates of phone theft and identity fraud have pushed second-factor authentication from a desired feature to a necessity. Touch ID allows developers to use the iPhone’s built-in fingerprint sensor without any of the heavy lifting of pattern recognition or low-level encryption. In this chapter, readers will learn about the framework and how to add fingerprint identification to their apps.
Ahmed Bakir, Gheorghe Chesler, Manny de la Torriente
Additional information