0%

Book Description

Discover exciting and fun projects by building brilliant applications for the Apple Watch

About This Book

  • Explore the opportunities opened up to developers by Apple’s latest device: the Apple Watch
  • Be a crackerjack at developing software across a broad range of watch app categories
  • From an eminent author, master all stages of development, from the first stage through to a completed project

Who This Book Is For

If you have some basic knowledge of programming in Swift and are looking for the best way to get started with Apple Watch development, this book is just the right one for you!

What You Will Learn

  • Understand the concept of the Apple Watch as an autonomous device as well as it being paired with the iPhone
  • Get your app up and running
  • Design exciting, inspiring, and attractive layouts for your apps
  • Make your user interface more engaging using images and animation
  • Enable your Watch and iPhone apps to transport and share data
  • Leverage the feature-rich set of WatchKit technologies provided by Apple
  • Connect your apps to the Internet
  • Submit your app to the App Store

In Detail

With Apple’s eagerly anticipated entry into the wearable arena, the field is wide open for a new era of app development. The Apple Watch is one of the most important technologies of our time.

This easy-to-understand book takes beginners on a delightful journey of discovering the features available to the developer, right up to the completion of medium-level projects ready for App Store submission. It provides the fastest way to develop real-world apps for the Apple Watch by teaching you the concepts of Watch UI, visual haptic and audio, message and data exchange between watch and phone, Web communication, and finally Visual, haptic as well as audio feedback for users.

By the end of this book, you will have developed at least four fully functioning apps for deployment on watchOS 2.

Style and approach

This is a step-by-step guide to developing apps for the Apple Watch with the help of screenshots and fully coded working examples.

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. Building Apple Watch Projects
    1. Table of Contents
    2. Building Apple Watch Projects
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. 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. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Exploring the New Platform
      1. Wide open future
      2. A closer look at the watch
        1. Building on success
      3. A look under the hood
        1. Vital statistics
        2. watchOS
        3. WatchKit
      4. One App, four interfaces
        1. The Main app
        2. Glances
        3. Correction
        4. Notifications
      5. User Input Hardware
        1. Digital Crown
        2. Force Touch
        3. Taptic Engine
        4. Audio in out
        5. ♥ It
      6. Extension of the iPhone, but more
        1. Opportunity knocks
      7. Summary
    9. 2. Hello Watch
      1. Setting it all up
        1. Creating a new Xcode project
        2. Check out what's new
        3. Building and running the app
      2. Looking over the project
        1. Three apps?
          1. iOS app
          2. WatchKit app
          3. WatchKit extension
        2. Three targets
        3. Two storyboards
      3. Adding some content on screen
        1. Preparing the interface
        2. Adding a button
      4. Give the UI some visual appeal
        1. Adding a group
          1. Creating a group object
          2. Tweaking the button
          3. Done
      5. Adding some animation magic
      6. Getting user input
      7. Ideas for self study
      8. Summary
    10. 3. C-Quence – A Memory Game
      1. Plan the app
        1. Mission statement
        2. User story
        3. App requirements
      2. Setting up the project
        1. Create the Xcode project
        2. Create Required Classes
        3. Building the interface
          1. Set up the Group hierarchy
          2. Add a button
          3. Copy and paste
      3. GameLogic
        1. Create the GameLogic class
        2. Plan the class
        3. Create the class's interface
        4. Define some enums
        5. Stub the methods
          1. Extend the sequence
          2. Evaluate
          3. Clear
          4. Define properties
        6. Check your code
      4. Interface Controller
        1. Planning the interface
          1. Define Outlets to the View
          2. Connect the UI with the Outlets
          3. Stub some preliminary methods
            1. Start the game
            2. Accept guess
            3. Game over!
          4. Check your code
          5. Hook up the UI with the Outlets
        2. Run the app
      5. Summary
    11. 4. Expanding on C-Quence
      1. Implementing the methods
        1. The InterfaceController class
        2. awakeWithContext
          1. playButtonTapped
          2. Declare additional constants
          3. playSequence
          4. timerFired
          5. flashColor
          6. redButtonTapped & Co
          7. colorButtonTapped
          8. endGame
        3. GameLogic
          1. Init the sequence array
          2. Extend the sequence
          3. Evaluating the user's input
          4. clearGame
        4. Test it
        5. Build and run the app
      2. Testing and tweaking
        1. The first test
          1. The first bug
          2. The first fix
          3. Test again
          4. Fix again
          5. Test
          6. Fix
          7. Test again
      3. Communicating with the phone
        1. Make it personal
          1. Getting the message across
            1. Requirements
            2. What classes will we need?
          2. Preparing both apps to communicate
            1. Create a Constants.swift file
            2. Define the constants
        2. Create the iPhone Connectivity Manager
          1. Instantiate the class in AppDelegate
        3. Getting the user name
          1. ViewController
          2. Prepare the UI
          3. Hook up the UI
        4. Creating the Watch Connectivity Manager
          1. Instantiate the class in ExtensionDelegate
          2. Modify the InterfaceController class
        5. Run and test
      4. Summary
    12. 5. On Q – A Productivity App
      1. Download the project template
      2. Plan the Watch app
        1. Mission statement
        2. User story
          1. The Watch app
            1. Launch view:
            2. Prompts view:
            3. Menu:
          2. The iPhone app
        3. App requirements
      3. Setting up the project
        1. Create the required watchOS classes
      4. Writing the code
        1. WatchConnectivity
          1. WatchConnectivityManager class
        2. WatchData
          1. WatchDataManager class
        3. Interface Controllers
          1. PromptsInterfaceController
          2. DetailsInterfaceController
        4. The Storyboard
          1. Preparing the images
          2. Using xcassets
        5. Designing the user interface
          1. PromptsInterfaceController
            1. Prompts Group
            2. PromptLabelGroup
            3. Buttons Group
            4. Start Group
            5. Other UI elements
          2. DetailsInterfaceController
        6. Implementing the methods
          1. ExtensionDelegate
          2. WatchConnectivityManager
          3. WatchDataManager
        7. Interface Controllers
          1. PromptsInterfaceController
          2. DetailsInterfaceController
        8. Build and run
        9. Test and Tweak
      5. Testing with the iPhone and real data
        1. Unstub the WatchDataManagerinit method
      6. Challenges for further growth
      7. Summary
    13. 6. Watching the Weather
      1. Adding a Glance to an app
        1. Plan the App
        2. Mission Statement
        3. User Story
      2. Setting up the project
        1. Requirements
          1. Weather data structure
      3. Getting the data
        1. Welcome to openweathermap.org
        2. Introducing JSON
          1. JSON data structure 101
          2. Making the data more readable
        3. Introducing NSURLSession
          1. Disabling App Transport Security
          2. Using NSURLSession
      4. Interface Controllers
        1. Testing in the console
        2. Completing InterfaceController
          1. Coding InterfaceController
          2. Building the Interface
        3. WeatherTableInterfaceController
          1. The simplicity of WatchKit tables
          2. Coding WeatherTableInterfaceController
          3. Parsing the JSON data
          4. Building the WeatherTable UI
        4. Run the app
        5. DetailsInterfaceController
          1. Coding the DetailsInterfaceController
          2. Creating the DetailsInterfaceController UI
        6. Run the complete app
      5. Glances
        1. Coding the GlanceController
          1. Building the GlanceController UI
        2. Building the Glance interface
        3. Running and testing the Glance
      6. Challenges for expansion
      7. Summary
    14. 7. Plot Buddy – All about Location
      1. Planning the app
        1. Mission Statement
        2. User Story
      2. Setting up the project
        1. Requirements
      3. Data structure
        1. Shared constants
      4. Getting location data
        1. Modifying the iPhone's Info.plist
        2. Creating PBLocationManager
          1. Create the Class
          2. Delegates and Protocols
          3. Define the protocol
          4. Implement PBLocationManager
      5. The Interface Controllers
        1. Create the InterfaceController class
        2. Test in the console
          1. Beware of the glitches
          2. Code
          3. Interface
          4. Test your code
        3. PlotsSceneInterfaceController
          1. CodingPlotsSceneInterfaceController
          2. Creating the UI
        4. Run the app
      6. WatchConnectivity
      7. Final test
      8. Challenges for expansion
      9. Summary
    15. 8. Images, Animation, and Sound
      1. Adding an icon
        1. Icon requirements
          1. Technical requirements
        2. Design considerations
        3. Using third-party utilities
          1. Complete icon set
          2. Graphics apps
        4. Sizes
          1. Understanding points and pixels
        5. Importing images into the project
      2. Animation
        1. Creating AnimationInterfaceController
          1. Create a new project
          2. Extending AnimationInterfaceController
          3. Add Outlets to AnimationInterfaceController
        2. Creating the UI
        3. Adding code to AnimationInterfaceController
          1. Some Constants
          2. Setting the UI layout in code
            1. Run the code
            2. Tweak the code
          3. Completing the animation code
        4. Less is more
        5. Run the app
      3. Audio and Video
        1. Adding a media file
        2. Adding the code
      4. Summary
    16. 9. Wear It, Test It, Tweak It, Ship It
      1. Installation on a physical device
        1. What if you don't have an Apple Watch?
        2. Registering your device
        3. Pair your Apple Watch and iPhone
        4. Select the device in Xcode
        5. Running on the device
        6. Installation troubleshooting
          1. Restarting, really?
            1. Restart just the app
            2. Restart the Simulator
            3. Delete the app from the Watch Simulator
            4. Delete the app from the iPhone Simulator
            5. Delete the Derived Data directory
            6. Reload the Xcode project
            7. Restart Xcode
            8. Restart Xcode
          2. Read the error messages
          3. Help online
            1. Stack Overflow
            2. Apple developer forums
      2. Testing in the field
        1. Wear it all day
        2. Scenarios not to be forgotten
        3. Beta testers
        4. Iterate testing and tweaking
        5. When testing is done
        6. Before you submit
      3. App Store submission process overview
        1. Phone Functionality
        2. Apple's guidelines
        3. Keep up to date
          1. Membership and certificates
      4. Preparing for submission
        1. Apple Developer Member Center
        2. Xcode distribution settings
        3. Using iTunes Connect
          1. Requirements for iTunes Connect
            1. App description
            2. Support URL
            3. App Store Icon
            4. Screenshots
          2. iTunes Connect optional data
            1. App Preview
            2. App Review Information
          3. The iTunesConnect process
          4. Submit for review
        4. Uploading the build with Xcode
        5. Upload
        6. Uploaded!
      5. Summary
    17. 10. This Is Only the Beginning
      1. Using animation to the fullest
        1. Advanced custom navigation
        2. Onboarding
      2. Making use of code snippets
      3. Post release maintenance
        1. Support
        2. Analytics
          1. Google Analytics
          2. Fabric/Crashlytics
      4. Expanding your skills
        1. HTTP
        2. Swift
        3. Program design topics
          1. Programming paradigms
            1. Object orientated programming
            2. Imperative programming
            3. Declarative
            4. Where Swift fits in
          2. Program design patterns
      5. Tools
        1. Terminal
          1. Help from afar
          2. Command line development
            1. Using cURL
            2. Creating a local server
        2. Xcode's Instruments app
        3. Application Loader
        4. Version control
          1. What is version control?
          2. Git and repos
          3. Git and Xcode
          4. GitHub
          5. BitBucket
          6. Which one to choose
        5. Personal favorites
          1. Graphics
            1. Graphic
            2. iConeer
            3. Bezel
          2. HTTP traffic
            1. Charles
            2. Wireshark
      6. Sites to be aware of
        1. Swift
          1. Open source Swift
          2. Swift blog
        2. Apple developer resources
          1. watchOS developer library
          2. WWDC vids
        3. Online help
          1. Stack Overflow
          2. Stack Exchange
          3. Apple forums
        4. My sites
          1. Support
          2. GitHub
          3. Best of the blogs
          4. NSHipster
          5. Erica Sadun
          6. Natasha the robot
      7. Stay in touch
        1. Follow the buzz
        2. Open source
        3. Real-world encounters
          1. Meet-Ups
          2. DevCons
      8. Summary
      9. One last word from the author
    18. Index
18.223.122.15