Plan the Watch app

Before we code, we plan. An hour's planning will generally save many hours' wasted coding. This is a good thing, and we've mentioned it before. We might even mention it again.

Mission statement

We will create an app that will prompt the user with small snippets of text for use in say, a presentation or lecture, or any other scenario in which she might otherwise rely on cue cards or similar. Each prompt screen can be swiped to a second screen that shows more detailed, scrollable text. The prompts can be color-coded if desired, perhaps as an indication to progress a slide presentation, or hand out printed material and so on..

The prompts can be advanced manually by tapping forward and backward buttons, or automatically each time the user raises her wrist to glance at the watch screen. The succession of prompts can be stopped by using Force Touch to show a menu, from which the user can stop or continue the sequence.

The text of the prompts (and the detailed text that accompanies each one) is entered into the iPhone, along with the desired color preset, and when the user has edited the list to her satisfaction, she sends the complete list to the Watch, which will replace the old list with the new one and store it locally, so that the watchOS app can be used when the iOS app is not available.

User story

As in the Chapter 3, C-Quence – A Memory Game, our first step to formalizing the app's requirements is to create a clear outline of what the user should experience when using the app.

The Watch app

When the user launches the app, he is presented with a single Start button. On tapping this button, he is presented with a request to load prompts from the phone if there are none stored on the watch or he is presented with the first prompt if there are some loaded. Each prompt may be presented in one of the three colors, which are stored along with the text.

Each prompt screen contains Forward and Backward buttons, but lowering and raising of the watch will also advance the current prompt. To stop the prompts, the user uses Force Touch, a harder press on the watch touchscreen to access a menu that will enable him to return to the start button (or continue on if he changes his mind or activated the menu inadvertently).

If the current prompt is the first in the list, the Backward button will be grayed out and inactive. If it is the last prompt, then the Forward button will be grayed out inactive.

The user is kept informed by a label of how many prompts there are available, and which one is currently selected. This label is only visible after tapping the Start button.

From each prompt, the user will be able to swipe sideways to a screen that shows further text in a scrollable form, but which offers no navigation except to return to the screen from which he reached this one.

Let's reduce this to an outline of what the app will provide to the user:

Launch view:

User taps Start button:

  • Check data manager for prompts data

If no prompts are loaded:

  • Show label requesting user to send them from phone

If prompts are loaded:

  • Show prompts and navigation
  • Hide Start button (and label, if showing)

Prompts view:

Show (first) prompt:

  • Get prompt from data manager
  • Set text and textColor
  • Enable Forward and Backward buttons as appropriate

If user swipes left:

  • Show detailed text

If user taps Forward/Backward buttons:

  • Show next prompt (as above)

User raises wrist to activate app:

  • Show next prompt (as above)

User deploys Force Touch to display menu:

  • Show menu

Menu:

  • Get user input

If player selects Cancel:

  • Dismiss menu

If player selects Stop:

  • Dismiss menu
  • Hide prompts view
  • Show Start button

Note that this list form is from the user's perspective and includes none of the behind-the-scenes action like connecting to the paired device.

The iPhone app

On launching the app, the user will be able to navigate to a list of the prompts currently stored on the phone. From this list view he will be able tap an Edit button to re-order or delete prompts, as well as create a new one by tapping a + button. Tapping the + button will in turn launch a third view, which will allow the user to enter the prompt text as well as an optional detailed text, and choose one of the preset colors (default will be white, since the watch app will have a black background). User will be able to save this prompt or cancel; either way he is returned automatically to the list of prompts.

On navigating back to the launch screen, the user will be able to tap a button to send the new prompts list to the Watch, where it will replace the old contents if there are any.

All of this functionality is coded for you in the downloaded project file.

App requirements

As we start to On Q:requisites" plan which classes we will require, we can now get a fair idea of the flow of the program, and therefore much of its functionality, from these outlines.

We will need to create a class that manages the app's data that is encapsulated away from direct interaction with the user, and just as with C-Quence, we will need a class that takes care of connectivity between the devices.

We will of course also add code to the files that Xcode creates for us as part of the WatchKit App template that we use to initiate the project, replace the InterfaceController file with something less generic, and create a second class of WKInterfaceController that will display the optional detailed text that may accompany a On Q:requisites prompt.

Note that the downloaded project template includes a SharedConstants.swift file that is a member of both the On Q and On Q WatchKit Extension targets, as pictured below (type Command-Option-1 if the File Inspector is not visible):

App requirements
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.182.66