PadCodedocs

Preview

Run your app on a real-size iPhone or iPad, use every button and step, and check how it looks turned sideways or in light and dark.

Preview runs your app the way people will use it: on the device you pick, at that device's real screen size, with every action working. Use it to try your app before you add it to My Apps.

The canvas only shows how your app looks. Nothing runs there, so buttons don't do anything and variables keep their starting values. Preview is where your app comes alive.

Preview: an app running on an iPhone 18 Pro, with Done editing at the top left and the device menu, the turn button and the debugger button at the top.

#Open Preview

  1. In the Builder, tap Preview in the toolbar, or press ⌘R.
  2. Use your app: tap its buttons, type in its fields, scroll, open its screens.
  3. To go back to editing, tap Done editing at the top left, or press Esc.

In a narrower window the toolbar shows Preview as a ▶ button without its name. In the narrowest, it moves into the ⋯ menu.

Preview always starts on your app's first screen: the one with the house next to it in the Library's Screens tab.

Preview after two taps on the coffee counter's button: Coffees today: 2.

#Pick a device

The menu at the top shows the device your app runs on. Tap it and pick another.

Each choice is a screen size, named after the newest model that has it. Your app lays out exactly as it would on that screen, inside a picture of the device. When the device is bigger than your window, Preview shrinks the whole thing to fit, so you still see all of it.

The device menu open, listing every iPhone, the iPhone Duo and every iPad.
Preview on the 13-inch iPad Pro.
DeviceScreenSize in points, uprightAlso stands for
iPhone 17e6.1″390 × 844iPhone 16e
iPhone 18 Pro6.3″402 × 874iPhone 17 and 17 Pro
iPhone Air6.5″420 × 912
iPhone 18 Pro Max6.9″440 × 956iPhone 17 Pro Max
iPhone Duo, closed5.4″ outer screen466 × 678
iPhone Duo, open7.6″ inner screen952 × 670
iPad mini8.3″744 × 1133
iPad Air 11-inch11″820 × 1180iPad (A16)
iPad Pro 11-inch11″834 × 1210
iPad Air 13-inch13″1024 × 1366
iPad Pro 13-inch13″1032 × 1376

Preview starts on the iPhone 18 Pro. After that it remembers the device you picked, and which way it was turned, for the next time you open it.

The device in Preview is separate from the canvas's iPhone and iPad switch: changing one doesn't change the other.

#The iPhone Duo

The iPhone Duo folds. iPhone Duo, closed runs your app on its small outer screen. iPhone Duo, open runs it on the big inner screen, which is wider than it is tall the way people hold it. Try both: a screen that fits the outer screen can look sparse on the inner one.

Preview on the iPhone Duo, open: the app on a wide inner screen, with the fold down the middle.
Preview on the iPhone Duo, closed: the app on the small outer screen.

#Turn the device

Tap the turn button, next to the device menu, to turn the device sideways. Tap it again to stand it back up. The device turns and your app lays itself out again for the new shape.

Phones hide the status bar at the top while they're sideways, as real iPhones do.

#Light and dark

Preview shows your app in the appearance the canvas shows: light or dark, set with the sun or moon button in the Builder's toolbar. If you haven't changed it, your app follows PadCode's own appearance.

A screen whose Appearance is set to Dark or Light (select the screen, then look in the Inspector's Style tab) keeps that look either way.

#What works in Preview

Everything your app does runs in Preview, for real:

  • Every action runs, step by step, in order: values change, screens open, alerts and messages show, timers tick, and Call API talks to the web.
  • Device actions use the iPad itself. Take Photo opens the camera, Scan Code reads codes with it, Pick Photos opens your photo library, Pick File and Save File open Files, and Share, Add to Calendar and Write Email open their usual sheets.
  • Permissions are asked for. The first time a step needs something private, like the camera or your location, PadCode asks first, with the reason you wrote in Permissions. Then iPadOS asks. Those permissions belong to PadCode: if you turned one off, turn it back on in Settings → PadCode.
  • Secrets work. Call API sends the secrets saved on this iPad.
  • Remembered values are kept. Variables set to remember their value keep it from one Preview to the next, and your app in My Apps uses the same values.

When a step fails, a red message at the top of the device says why. Tap it to close it. The debugger shows what ran before it and what to check.

If someone closes the camera, the scanner or a photo or file picker without choosing anything, the steps after it don't run: there's nothing for them to use. The debugger notes it.

#What your iPad might not be able to do

Some steps need hardware or settings that not every iPad has. They fail with a message that says what's missing:

StepWhen it can't runWhat it says
Take PhotoThe device has no camera.This device has no camera, so Take Photo can't run here. Try it on your iPad.
Scan CodeThe device can't scan.This device can't scan: scanning needs a camera, so try it on your iPad.
Write EmailMail has no account on this iPad.Mail isn't set up on this iPad. Add an account in Settings → Apps → Mail.
Ask Apple IntelligenceThe iPad can't run Apple Intelligence, it's turned off, or it's still getting ready.This iPad can't run Apple Intelligence. · Apple Intelligence is off. Turn it on in Settings → Apple Intelligence & Siri. · Apple Intelligence is still getting ready. Try again in a little while.

#When you close Preview

Timers your app started stop. The next Preview starts fresh on the first screen, with the debugger empty.

What ran isn't lost: switch the Builder to Flow and the board shows what each step did in its last run. See Flow.

#See also