PadCodedocs

Flow

See a screen's logic as a board of connected steps, edit it there, and check what each step did in the last Preview.

Flow shows a screen's logic as a board. Each When is a row: the trigger first, then its steps from left to right, with the steps inside an If or a Try branching off below. It's the same logic as in the Inspector's Actions tab, drawn as a map, and a change in one shows in the other.

Flow: a button's When Tapped row. Each If branches into YES and NO, and the YES branch shows a message and stops.

#Open Flow

  1. Select a view on the canvas, and open the Inspector's Actions tab. The toolbar now shows Simple and Flow.
  2. Tap Flow. The board opens on the view you selected.

To go back to the canvas, tap Simple. In a narrow window, the switch is in the toolbar's ⋯ menu, under Mode. In Agent mode, neither is there: leave Agent mode (⌘I) to open Flow.

#Read the board

The button at the top left picks whose logic the board shows:

  • Everything on This Screen: every When on this screen that has steps.
  • The Screen Itself: the screen's own Whens, like When Shown.
  • One view, picked under A View: all of that view's Whens.

Each row starts with a trigger card: WHEN, what happens (like Tapped), and the view's name. Its steps follow, joined by lines in the order they run. Each step card shows the action's name and its first settings in short.

Steps that hold other steps show them as a branch below the card, each with a tag:

TagWhere it comes from
YES and NOAn If: its Then and Else steps
TRY and IF IT FAILSA Try: its Do and Catch steps
FOR EACH ITEMA Repeat for Each
A button's title, like “DELETE”Each button of a Show Alert
DOAnimate and Start Timer
ON DISMISSOpen as Sheet

A view with no steps yet shows its first When, empty. If nothing on the screen has steps, the board says No logic here yet: pick a view in the menu at the top left to give it some.

#Add and change steps

  • Add a step: tap the + at the end of a row or a branch, and pick an action. It's added there and opens on the right.
  • Change a step: tap its card. The right panel shows its settings, the same as in the Actions tab, with Duplicate and Delete under them. Steps inside it are edited on the board, in its branches.
  • Move, copy or delete: touch and hold a step card for Add Step After, Move Left, Move Right, Duplicate and Delete.
  • Add to or clear a When: touch and hold its trigger card for Add Step and Remove These Actions.
Flow with a Show Message step picked: Last run, then its Text, Style and Seconds, with Duplicate and Delete.

#Add a When

While the board shows one view, or the screen itself, Add a When sits under its rows. It lists the view's other Whens, the ones not on the board yet. Pick one, then tap the + in its new row to add the first step. A When stays once it has a step; an empty one goes away when you pick another view.

#See what each step did

Flow reads the latest Preview. Until there is one, the top right says Run it in Preview to see what each step does: tap it to open Preview, use the app, then close Preview and come back.

Flow after Preview: Show Message and Play Haptic each have a check mark and Done, and the top right says Last run: every step worked.

Then each row shows its own latest run:

  • The top right sums it up: Last run: every step worked, or how many steps failed, like Last run: 1 step failed. Clear forgets the run.
  • A step that worked has a check mark; a step that failed has a red mark. A step that ran more than once, like inside Repeat for Each, shows how many times, like ×3.
  • Under each step that ran, one line says why it failed, or the last thing it did (like a variable it changed), or Done.
  • Steps that didn't run, because an If went the other way or the run stopped before them, are faded, and so are the lines to them. The path the run took stands out.

Tap a step to see its Last run at the top of the right panel:

LineWhat it says
Worked, Worked, 3 times or FailedHow it went
WhyWhy it failed
WithThe settings it ran with, as they were at that moment
GaveWhat it changed, or what came back, like a Call API's answer

Notes follow when there are any, like a Try catching a failure. A step that didn't run says so: "It didn't run: the steps before it took another way, or stopped."

#See also