You’ll use Xcode when creating an app to run on the Apple Watch, just like when you develop for iOS. The structure is a little different, though. In iOS, you usually have a single target for the app, but you’ll always have two when creating a watchOS app.
Start Xcode and create a new project. You’ll notice some tabs at the top of the template chooser dialog. The Multiplatform tab is the default selection.
While you could start from the App template, you shouldn’t. Instead, select the watchOS tab:
If you’re reading this book, you probably need a watch app. However, what type of app are you going to create?
Does the watch app stand alone, with no corresponding iOS app?
Does the watch app require a companion iOS app to function properly?
Does the watch app function on its own, but there’s also an iOS app?
Most of this book’s chapters pretend that you’ve chosen the first option. The watch app will be fully functional and won’t need a companion iOS app. As the Apple Watch is the focus of this book, I don’t want to confuse the examples with a ton of code for an iOS app that doesn’t add value. One of the later chapters will provide instructions for tying your Watch App to an iOS app if required.
Select the App template, pick a name for your project, and leave the default selection of Watch-only App. I chose Standalone for the name of the project.
Take a look at the targets, and you’ll see the template created two for you:
Standalone is the general target for your project. It acts as a wrapper for your project so that you can submit it to the App Store.
Standalone Watch App is the target for building the watchOS app. An app bundle contains your watchOS app’s code and assets.
You’ll seldom interact with the first target. When you think of an Apple Watch app you’re talking about the extension.
Including an iOS App
If you’re going to have both an iOS and a watchOS app, select the Watch App with New Companion iOS App option when creating a new project. You can choose any name you like — I chose Example — and leave the defaults for everything else. Click Next and choose a location. You’ll get Xcode’s main window.
While many watchOS apps require a companion iOS project, it’s also possible for a watch app to fully function without a companion iOS app. By default, Xcode assumes your watchOS app is unable to run without an installed companion iOS app.
Baga: Ncefeaeh pifmeujz saboocyov ni huxrizp dojboib jitielogp o fisgediam umm.
Ok taut zusdd axp yiz piv fifsait o tagguytohbiby iID avv, vbos yoi’mz juew ju roze u lvakf xohsenuyuyuel zsilno: