You are previewing Apple Watch App Development.
O'Reilly logo
Apple Watch App Development

Book Description

Build real-world applications for the Apple Watch platform using the WatchKit framework and Swift 2.0

About This Book

  • Find out how to download and install the Xcode development tools before learning about Xcode playgrounds and the Swift programming language

  • Discover everything you need to know about the WatchKit platform architecture, its classes, as well its limitations

  • This book introduces you to the very latest mobile platform with hands-on instructions so you can build your very own Apple Watch apps

  • Who This Book Is For

    This book is for developers who are interested in creating amazing apps for the Apple Watch platform. Readers are expected to have no prior experience of programming.

    What You Will Learn

  • Navigate within the WatchKit interface using the page-based, modal, and hierarchical navigation techniques

  • Work with context menus to allow your users to interact with the Apple Watch and respond to their actions to perform a task

  • Use the MapKit framework to display a map within the WatchKit interface to track the user's current location

  • Build effective user interfaces for the WatchKit platform and integrate iCloud capabilities to synchronize data between the iOS app and the WatchKit UI

  • Design your apps for the Apple Watch platform by adhering to the set of User Interface design guidelines set out by Apple

  • Reinforce image caching to display animations within the Apple Watch user interface

  • Explore WatchKit tables, which allow your users to purchase groceries and pay for them using Apple Pay

  • Analyze the new layout system to ensure that your Apple Watch apps work with various screen sizes

  • In Detail

    Wearable are the next wave of mobile technology and with the release of Apple’s WatchKit SDK, a whole new world of exciting development possibilities has opened up.

    Apple Watch App Development introduces you to the architecture and possibilities of the Apple Watch platform, as well as an in-depth look at how to work with Xcode playgrounds. Benefit from a rapid introduction to the Swift programming language so you can quickly begin developing apps with the WatchKit framework and the Xcode Development IDE. Get to grips with advanced topics such as notifications, glances, iCloud, Apple pay, closures, tuples, protocols, delegates, concurrency, and using Swift Playgrounds, with each concept is backed up with example code that demonstrates how to properly execute it. Finally, discover how to package and deploy your Watch application to the Apple AppStore.

    By the end of this book, you will have a good understanding of how to develop apps for the Apple Watch platform, and synchronize data using iCloud between the wearable and the iOS device.

    Style and approach

    This book takes a step-by-step approach to developing applications for the Apple Watch using the Swift programming language and the WatchKit UI. Each topic is explained in a conversational and easy-to-follow style.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Apple Watch App Development
      1. Table of Contents
      2. Apple Watch App Development
      3. Credits
      4. About the Author
      5. Acknowledgements
      6. About the Reviewer
      7. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Introducing the Swift Programming Language
        1. Registering as an Apple developer
        2. Getting and installing Xcode development tools
        3. Introduction to Xcode playgrounds
        4. Introduction to the Swift language
          1. Variables, constants, strings, and semicolons
            1. Variables
            2. Constants
            3. Strings
            4. Semicolons
          2. Numeric types and conversion
          3. Booleans, tuples, and string interpolation
            1. Booleans
            2. Tuples
            3. String interpolation
          4. Controlling the flow
            1. The for…in loops
        5. What's new in Swift 2.0
          1. Error handling
          2. Binding
          3. Protocol extensions
        6. Summary
      10. 2. Understanding Apple Watch
        1. Introduction to the WatchKit platform
          1. Introducing the WatchKit application architecture
          2. Introducing the WatchKit application life cycle
          3. Introducing the WatchKit classes
          4. Limitations of the WatchKit platform
        2. Apple Watch Human Interface Guidelines
        3. What's new in watchOS 2
          1. Watch faces
            1. Photos
            2. Time-Lapse
          2. Time travel
          3. Nightstand mode
          4. Activation Lock
          5. FaceTime audio
          6. Social features
        4. Summary
      11. 3. Exploring WatchKit Controls
        1. Building the Guessing Game application
          1. Using Interface Builder to create the watch user interface
            1. Adding our user interface controls – text and labels
            2. Creating Outlets to our Interface Builder objects
            3. Creating Actions that respond to user actions
          2. Building and running the Guessing Game application
        2. Summary
      12. 4. Using the Core Location and Watch Connectivity Frameworks
        1. Creating the navigation tracking application
          1. Building the Watch Tracker application – iPhone
            1. Adding and removing annotation placeholders
            2. Handling requests for background location updates
            3. Building and running the Watch Tracker application
          2. Building the Watch Tracker application – WatchKit
            1. Limitations of using Core Location within watchOS 2
          3. Using Interface Builder to create the Watch Tracker UI
            1. Creating the Outlets for our Interface Builder objects
            2. Creating an Action event to handle our map zooming
          4. Using Core Location with the WatchKit extension
          5. Communicating between the iPhone app and the WatchTracker WatchKit extension
            1. Integrating the Watch Connectivity framework – iPhone app
            2. Integrating the Watch Connectivity framework – WatchKit extension
            3. Building and running the Watch Tracker application
        2. Summary
      13. 5. Navigating Around in WatchKit
        1. Building the Health Monitor application
          1. Understanding page-based interfaces and navigation
          2. Understanding modal interfaces and navigation
          3. Understanding hierarchical interfaces and navigation
          4. Integrating the HealthKit framework to handle updates
          5. Integrating the HealthKit framework – iPhone app
          6. Building the Health Monitor application – WatchKit
            1. Creating the profile details interface controller's WatchKit class
            2. Creating the Outlets for our Interface Builder objects
          7. Creating an Action event to handle our Start Monitoring button
          8. Using HealthKit to obtain heart rate and pedometer information
          9. Using HealthKit to obtain biological personal information
        2. Building and running the Health Monitor application
        3. Summary
      14. 6. Implementing Tables within Your App
        1. Building the Shopping List application
          1. Setting up and provisioning your app for Apple Pay
          2. Configuring our Shopping List app to work with Apple Pay
          3. Understanding the WatchKit table object
          4. Building the Shopping List application – WatchKit
            1. Creating the table row interface controller's WatchKit class
            2. Configuring our product table row controller class
            3. Creating the product class structure to hold product items
            4. Creating the ProductsList property list
            5. Populating our WatchKit table controller with row information
            6. Responding when a row has been selected within our table
          5. Running the Shopping List application – WatchKit
          6. Handling payment requests with the PassKit framework
        2. Building and running the Shopping List application
        3. Summary
      15. 7. Adding Menus to Your App
        1. Introduction to gestures and the menu interface
          1. Understanding WatchKit context menu gestures
          2. Understanding the WatchKit context menu interface
        2. Design considerations for WatchKit context menu icons
          1. Understanding the default WatchKit context menu actions
        3. Adding a menu to our Shopping List application – WatchKit
        4. Establishing the WatchKit context menu connections
        5. Design considerations when using Taptic Engine
          1. Learning how to integrate Apple Watch haptics within an app
          2. Running the Shopping List application – WatchKit
        6. Summary
      16. 8. Incorporating the Glance Interface in Your App
        1. Introduction to working with WatchKit glances
          1. Understanding the glance controller life cycle
        2. Adding a glance to our Shopping List application – WatchKit
          1. Creating a glance build scheme for our Shopping List app
          2. Creating the glance interface controller WatchKit class
        3. Configuring our glance controller using templates
        4. Establishing glance interface controller connections
        5. Storing information to show within your glance controller
        6. Displaying information within your glance controller
        7. Understanding the glance interface guidelines
        8. Running the Shopping List application – WatchKit
        9. Summary
      17. 9. Incorporating Notifications within Your App
        1. Working with WatchKit notifications
          1. Understanding the notification controller life cycle
        2. Configuring the notification scheme for our Shopping List app
        3. Adding Action buttons to your dynamic notifications
          1. Responding to actions within your custom notifications
          2. The difference between static and dynamic interface controllers
          3. Configuring our Shopping List app's dynamic notification controller
        4. Establishing our notification controller connections
        5. Configuring a category for our static interface controller
        6. Scheduling notifications with your notification controller
        7. Displaying messages within the notification interface
        8. Understanding the notification interface guidelines
        9. Running the Shopping List application – WatchKit
        10. Summary
      18. 10. Image Compression and Animation
        1. Building the animation application – WatchKit
          1. Setting up and adding images to the assets catalog
          2. Configuring our app to use App Transport Security
          3. Using Interface Builder to create the watch user interface
            1. Establishing connections to our interface controller
            2. Establishing our Action events that respond to user actions
            3. Animating your images within the WatchKit interface
            4. Loading and compressing images within the WatchKit interface
            5. Building and running the Animation Example application
        2. Summary
      19. 11. Packaging and Deploying Your App
        1. Creating and setting up your iOS development team
        2. Creating the iOS development certificate
        3. Obtaining the development certificate from Apple
        4. Creating App IDs for your WatchKit applications
        5. Creating development provisioning profiles
        6. Profiling your application using Xcode Instruments
        7. Preparing your app for submission using iTunes Connect
        8. Submitting an app to iTunes Connect using Xcode
        9. Summary
      20. Index