It is about time we started getting a little technical. We are, after all software developers, and tempting as it may be to look at the many aesthetic qualities of the Watch, we are here to roll up our sleeves and get our hands dirty, and devote ourselves to some technical specifications of the device that will have a direct impact on our work. And the web really has no shortage of images, and articles about, the various and sometimes very luxurious materials and styling that, whether we like to admit it among ourselves or not, are as important to potential early adopting watch owners as all the hard work we do as developers.
So let's start with answering a few questions around the environment in which we will (very soon) be creating our software.
What hardware are we dealing with, exactly?
What is watchOS 2?
What is WatchKit?
We'll start by taking a look some features of the hardware that are relevant to the developer.
Downloading the example code
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 files e-mailed directly to you.
The 38mm model's casing is 33.3mm wide, its height is actually 38.6mm, and houses a display measuring 21.11mm by 26.52mm.
The 42mm model's width is 35.9mm, and has a display measuring 24.34mm by 30.42mm
Both models' casings are 10.5mm deep.
Onto this tiny canvas, Apple have managed to squeeze an impressively sharp and vibrantly colored, pressure sensitive touchscreen, with resolutions of 272 × 340 px on the smaller model, and 312 × 390 px on the larger, giving 290 pixels per inch (PPI)—also often referred to as dots per inch (DPI)—enough resolution to satisfy even the most fastidious graphics geek.
The screens of the least expensive model, the Sport model, are, according to Apple:
…protected by a lightweight aluminosilicate glass that's especially resistant to scratches and impact.
Hands up anyone who can tell us about aluminosilicate glass?
All other models are equipped with Sapphire screens; this sounds a little less technical but it is the second hardest transparent material on earth after diamonds. So don't store one in your pocket together with any diamond jewelry.
The 18 hours of battery life claimed by Apple has proved to be a perfectly reasonable estimate, assuming the pattern of engagement that most of us are anticipating at the moment, and even under heavy use and testing during development, the watch is able to go a full working day without a recharge. The user can, when the remaining battery charge becomes perilously low, activate a low power mode that will restrict the watch to telling the time, and your app stays shut out in the cold. We will, of course, later have a look at what power conservation considerations you will want to be including when designing your own apps to avoid this situation.
Apple does the heavy lifting around designing and coding for a single device, one that just happens to come in two sizes, so you will only be working on a single UI design, and only writing one set of source code.
Just to round off the vital statistics, the Watch has 512MB of RAM and 8GB of storage, but the companion app on the iPhone (and there always is one) will store most of your larger resources, images and video, for example, if you have any.
Based on and in many respects similar to iOS, watchOS is the operating system that powers the Watch. It is orientated towards conserving power and the economic use of resources in memory, while offering a rich and engaging experience for the user, and most developers will find leveraging their previous iOS programming experience easy and intuitive, while adapting to the optimizations of many common programming tools and techniques. You will grow accustomed to alternate ways of providing information to the user, for example using tables to display lists, which, while visually similar to those on an iPhone, are handled quite differently at a code level to tables in iOS.
watchOS was revealed to the world along with the Watch in April 2015, and was upgraded to watchOS 2 in the following October. From our perspective as developers, version 2.0 was a huge leap forward, not only as the Watch gained the ability to function away from the iPhone, significantly increasing its scope of use, but also because, just as critically, we gained access to many of the features of watchOS and its hardware that were hitherto reserved for Apple's own apps, most notably the Taptic Engine, Digital Crown, accelerometer, heart rate sensor, speaker, and microphone, and the addition of custom Complications (some of which we will be looking at shortly).
WatchKit is the Apple framework that will provide you with the technologies that you will use to create your apps. Think of WatchKit as a vast library of code that all developers will need, code that has been written, tested, and optimized for you by the very people that built both the hardware and its operating system, ensuring a maximum level of uniformity, compatibility, code safety, security, and convenience for the developer. There is, to take one example, a massive amount of work for your app involved in redrawing a button when its title changes, work that will be almost identical every time that button changes its appearance in any way, but you as a developer will only write one line of code to get all that boiler plate set up.
This you will likely know already from UIKit, with which iOS apps spring to life.