Learn about the three major parts of an watchOS project, why we need an iPhone app, the difference between the watchOS extension and the watchOS app extension, and watch apps.
- [Narrator] The Apple Watch is not like an iPhone or an iPad. Watch OS 3 differs in some surprising ways from iOS. To understand the Apple Watch, you need to know a little bit about the architecture behind the watch. Without this knowledge, it's easy to get lost in Xcode while making a Watch OS app. There are three parts you should be familiar with. The iPhone app, the WatchKit app, and the WatchKit Extension. The iPhone app is an iPhone application. You can write a full application here for the phone and never touch the Watch OS parts of the code if you wish.
Many applications are iOS apps, which communicate to the watch. An iOS app gives some small functionality to the watch and leaves most of the functionality to the phone. Some applications require data that can only be found on the phone, such as Healthkit data, or on Series One watches, GPS coordinates. The iPhone app loads the watch application on the watch. The Watch app has the resources necessary for the user to interact with their watch. The Storyboard is in the WatchKit app.
Here's where you design your user interface for your application and for notifications from the phone. If you have images, audio files, or videos in your interface, you will store them here. System icons are also in the WatchKit application. If you're familiar with Model-View-Controller, the WatchKit app contains the view. The WatchKit Extension contains the Watch OS code you'll write to control the watch and any data stored on the watch. In Model-View-Controller, this is where you find the controller, which we'll refer to in Watch OS as the Interface Controller.
It will handle the interactions from the WatchKit app. If you are storing data on the watch, you'll place your model in the watch. Any assets, such as images, video, or music must be referenced and stored here. Images for complications are also stored here. In Xcode, you'll find these three parts are pretty isolated from each other. If you make a mistake and place a component in the wrong place, the Watch application won't work. As you begin Watch applications, you'll find it easy to make these mistakes. I certainly have myself.
Pay attention to where you place files and assets.
- Breaking down the parts of a watchOS app
- Building an interface
- Adding and scaling images
- Adding navigation
- Playing audio and video
- Connecting objects to code
- Writing watchOS code
- Working with tables
- Programming notifications
- Working with complications