Core concepts

- I'm going to begin with five facts.Five things that are true about Apple Watch developmentright now.We're not getting into syntax yet,this is high level information that I just wishsomeone had straight away told me in my firstfive minutes of Apple Watch development.If you've been exploring Apple Watch development,you may know some of these already,but they'll set the stage for what we're about to do.Fact number one, there is no Apple Watchproject template in Xcode.You can't go into Xcode and just makean Apple Watch app.

That was something a lot of people kind of expected.Apple released the first beta for Watch kitat the end of 2014.Lot's of us downloaded it.We installed this new version of Xcode,we opened it, and the first thing we all didwas click on create new Xcode projectand say, okay, where's the Watch project?Well you can look for it all you want,it's not there.There is not Watch project in Xcode.Instead you must begin with an iPhone app,a regular Xcode iPhone project.Either a new one, or one you already haveand then add a Watch app to thatas part of an existing iPhone project.

But why and what does that mean?Fact number two, your Watch app requiresa paired iPhone.Okay, this might not seem like news,but Simon, everybody know that if you have an Apple Watchyou need an iPhone to go with it.That's not what I'm talking about here.You see there are Watch apps that happily runall by themselves.You can go out for a jog and leave your phone behindor even turn the phone off and you'll stillbe able to play music, use the work out app,use Apple Pay, view photos.Those apps are Apple's Watch applications, not ours.

We are third party developers and every third partyapp requires the phone connectedto be able to run at all.Why? Because all our Watch apps are in two parts.A part that resigns on the Watchand a part that resigns on the iPhoneand it's the part on the iPhone that does all of the work.That's fact number three.The code you write for your Watch app,that swift or that objective, see, it's going to runon the iPhone not on the watch.Let me say that again.The code that your write here,all your logic, all your behavior,is going to run on the iPhone not on the Watch.

The only thing that's installed on the Watchis your user interface.Your storyboards with your buttons,labels, switches, tables, any image assets you need,like icons, graphics, or animations,the user interacts with that on the Watchand it will communicate with and use your iPhoneto do any processing that needs to happen.This is an intentional limitation right now.As a third party developer, with this initial releaseof Watch kit, we are not able to createa standalone, self-contained, native Watch app.

That's true today, it may...That's right, I wasn't going to say that anymore.So you might wonder, what are we doing here?Are we creating a Watch app that has an iPhone pieceor are we creating an iPhone app with a Watch piece?Well fundamentally it is an iPhone projectwith added Watch support.Even Apple's initial Watch kit pages on the webhad that phrase.You weren't being told to make a Watch app,you were being told to get your iPhone app readyfor Apple Watch.That's the right perspective.

That might not be the way you are thinking about things.You're watching this course thinking,hey, I've got a great idea for a Watch app.Excellent, but you're still going to have to beginby making an iPhone app.Fact four, because all our code runs on the phone,we don't have access to special hardware on the Watch,like the heart rate monitor.Direct access to the tap-tick engine,we'll be able to change the behavior of the digital crown.We are working in a much more constrained environmentand Apple are not letting us have accessto those things yet.

So one, there is no Watch project.We add Watch support to an iPhone project.Two, our apps need a connected iPhone to run at allbecause three, our code is going to run on the iPhone,and because of that four, we don't have direct accessto the Watch specific hardware.Fact number five, despite all of these initial limitationthere is still a lot we can do.Let's make our first Watch app.

Resume Transcript Auto-Scroll

Author

Released

6/8/2015

Take your existing iOS development skills and learn to create apps, glances, and notifications for the Apple Watch. Simon Allardice gives you a first look at developing for Apple Watch using the new API, WatchKit. He covers the new user interface and controls, and the surprising differences between tables and rows, multiscreen layouts, and navigation in iOS and Apple Watch. The course wraps up with a look at the exciting new optional elements in Apple Watch: glances and notifications.