Book Image

Apple Watch App Development

By : Steven F. Daniel
Book Image

Apple Watch App Development

By: Steven F. Daniel

Overview of this book

With the increasing amount of new wearable devices hitting the market, wearables are the next wave of mobile technology. With the release of Apple's WatchKit SDK, a whole new world of exciting development possibilities hasopened up. Apple Watch App Development introduces you to the architecture and limitations of the Apple Watch platform, followed by an in-depth look at how to work with Xcode playgrounds. Here, we'll introduce you to the Swift programming language so you can quickly begin developing apps for the Apple Watch platform with the WatchKit framework and the Xcode Development IDE. We then discuss more advanced topics such as Notifiations, Glances, Closures, Tuples, Protocols, Apple pay, and using Swift playgrounds, with each concept backed up with example code that demonstrates how to properly execute it. We also show you 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 Apple Watch platform using the WatchKit framework and Swift 2.0.
Table of Contents (19 chapters)
Apple Watch App Development
Credits
About the Author
Acknowledgements
About the Reviewer
www.PacktPub.com
Preface
Index

Displaying information within your glance controller


In the last section, we modified our interface controller class so that it can store information within our NSUserDefaults class and display the chosen shopping list product information within the Apple Watch glance interface controller.

In this section, we need to create the necessary code that will be responsible for retrieving information stored within our standardUserDefaults repository database and display the chosen shopping list product item within our glance. Perform the following steps:

  1. Open the GlanceInterfaceController.swift file located within the ShoppingList WatchKit Extension group in the project navigation window.

  2. Next, locate the willActivate method and enter the following code snippet:

    override func willActivate() {
            // This method is called when watch view controller 
            // is about to be visible to user
            super.willActivate()
            
            let userDefaults = NSUserDefaults.standardUserDefaults()
      ...