You should read the introduction below about the structure of the WatchBench
system and how it fits into the frameworks that iOS provides.
You should then look at the other Help files,
especially the one explaining the WatchBench Project Files and
the App User Interface.
You can either read the detailed API Reference, or try the Sample Files,
reading the material they display when first loaded.
Please check the "News and Support" help file periodically.
It loads and displays up-to-date information from the support web site,
including about bugs, Frequently Asked Questions, where to get additional support,
and other useful material.
In order to create projects in WatchBench, you should understand
the general architecture of an iOS application that uses the WatchKit
framework with Apple Watch.
You also need to understand the different pieces that make up
a running WatchBench project.
This section covers both of those topics.
In the initial release of Apple Watch, Apple provided software developers
with the WatchKit framework (a code library provided by Apple) for making custom apps.
WatchBench works by using that framework.
The iOS WatchKit framework is used to give custom apps the ability to
manipulate the interface of an Apple Watch app.
The code for the custom app runs on the iPhone that is paired with
Apple Watch, and WatchKit manages the communication between the two devices.
iOS WatchKit Framework
iOS WatchKit Framework
WatchBench is a normal iOS app that runs on the iPhone.
It has a visible user interface.
It manages a variety of files on the iPhone.
In addition to the WatchBench app, there is "WatchKit extension"
code that is part of WatchBench.
This extension code is not visible.
It runs when needed in the background, even when the
visible app is not running. It is driven by
the iOS WatchKit framework.
The extension has access to the same data files as the
WatchBench iPhone app.
The iOS WatchKit framework communicates wirelessly with the watch,
loading data, and updating the extension with information
about the state of the watch, activation of the display,
taps on buttons, etc.
An iOS app that supports Apple Watch always has WatchKit extension code.
If the app is set with "Show App on Apple Watch" in the My Watch settings
for Apple Watch on the iPhone, then certain fixed, predefined specifications
about the visible interface objects (labels, buttons, switches, groups containing
these, separate pages, etc.) are loaded into the watch.
These specifications are fixed as part of the iPhone app itself
when it is created by the iOS developer.
The WatchKit API is used by the extension code to set the properties of
those objects and react to various events.
The way WatchBench works is that it was built with a large set of
predefined interface objects. That heavily-populated app is loaded onto the watch.
When the WatchBench app is launched on Apple Watch,
the WatchBench WatchKit extension then hides all of those objects
except for ones that are specified in a configuration file.
This allows the WatchBench developer to specify a wide range of different applications
that run using the same set of predefined interface objects.
events on the watch that come through the WatchKit framework and to
make changes to objects on the watch through WatchKit calls.
edited using the WatchBench iPhone app's user interface:
WatchBench app with file viewers and editor
WatchBench WatchKit Extension with JS context
WatchBench predefined labels, buttons, etc.
To create a working WatchBench project,
you must create a configuration file that describes the interface
objects that will be displayed.
These files are named "initialWatchConfig.txt" and "intitialWatchJS.txt",
You can also provide an optional "index.html" file that is displayed in
a simple web view on the iPhone app display.
This HTML page (known as the Project Web App)
may be used to provide documentation to the user, read and write
various shared data files, and other purposes.
When you create a new project (by tapping the "+" button when viewing
the list of projects),
WatchBench will automatically populate the project folder
with minimal template versions of these files to get you started.
All of the files, and the APIs they support, are documented
in the Help files accessible by tapping the Help button at the bottom
of the iPhone app screen.