Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building Apple Watch Projects

You're reading from  Building Apple Watch Projects

Product type Book
Published in Feb 2016
Publisher Packt
ISBN-13 9781785887369
Pages 298 pages
Edition 1st Edition
Languages
Author (1):
Stuart Grimshaw Stuart Grimshaw
Profile icon Stuart Grimshaw

Table of Contents (17) Chapters

Building Apple Watch Projects
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Exploring the New Platform 2. Hello Watch 3. C-Quence – A Memory Game 4. Expanding on C-Quence 5. On Q – A Productivity App 6. Watching the Weather 7. Plot Buddy – All about Location 8. Images, Animation, and Sound 9. Wear It, Test It, Tweak It, Ship It 10. This Is Only the Beginning Index

Testing with the iPhone and real data


We are now ready to test entering user data into the iOS app (which should work without issues—you downloaded it from the website, after all) and to test the transfer of that data to the watchOS app.

If you have already run the iPhone app and tested what the buttons do (we're developers, we're naturally curious, OF COURSE you've played around with it), then you will already have sent some default data to the Watch. Let's get rid of that first by deleting the app from the iOS Simulator.

Now we're all starting from the same point.

Unstub the WatchDataManagerinit method

Although we have stored prompts data to NSUserDefaults in the updatePrompts method, we still have a dataManager that returns stubbed data, so let's fix that now. Replace the init of the current WatchDataManager implementation with the following code:

private init(){
    if let storedPrompts = NSUserDefaults.standardUserDefaults().objectForKey(kPromptsKey) as! [Prompt]? {
            self.prompts...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}