Refine and verify · XCODE / CHATGPT

SwiftUI Preview Works, but Simulator Looks Wrong

Compare source, fixtures, environment, navigation and persisted state when SwiftUI previews and the running app disagree. Use matched evidence before changing layout.

Make the inputs comparable before changing the view. A preview renders the content and environment you configure for it; the running app adds its real entry point, navigation, data and saved state. A difference between those inputs can explain different output without a layout bug.

1. Record what each image represents

Apple’s preview system is designed to show configured view content in Xcode. [1] Use it to investigate a view, but record the preview declaration and fixture that produced the image. For the Simulator image, record the project, scheme, destination, screen path and data state.

A useful comparison starts from the same source revision. If the preview comes from one checkout and the app from another, investigate the source mismatch first. If both use the same source, identify which observable difference matters: clipping, color, missing content, navigation or a value that resets.

2. Compare the inputs systematically

Preview and Simulator comparison sheet
InputPreview questionRunning-app question
DataWhich fixture and empty/loading state?Which account, stored values or network response?
ContainerIs the view inside the real navigation or sheet?What parent constrains its size and safe area?
EnvironmentAny explicit appearance, locale or text-size override?What device and user settings are active?
LifetimeDoes the fixture recreate the model?What happens on navigation, backgrounding and relaunch?
SourceWhich file and revision produced this render?Which product and destination were just built?

3. Reproduce one mismatch with matched data

Consider a card that looks balanced in Preview but clips a title in the app. If the fixture says “Notes” and the live record has a long localized title, the first experiment is to use that long title in the preview. If it then clips too, inspect the layout constraints. If it does not, compare the parent container and text size next.

Similarly, a preview with a preloaded model cannot establish that the real loading path works. Add fixtures for loading, empty, failure and populated states that matter to this screen. Change one input at a time so you can explain which difference caused the behavior.

TRY THIS IN CHATGPT
Investigate this Preview-versus-Simulator mismatch.
Difference: [precise observation]. Source revision: [revision].
Preview declaration and fixture: [details].
App scheme, destination, navigation path and data: [details].
Compare source, data, containers and environment before editing.
Propose one experiment at a time. After a repair, report separate
preview and running-app results, with their settings and limitations.

4. Keep visual checks and runtime checks distinct

A fresh render can support a claim about the displayed arrangement under specified inputs. It cannot establish that a save survives process termination, a request is cancelled correctly or an interaction works on hardware. Debug running behavior in the running app; Apple’s debugger guidance provides the relevant foundation. [2]

For device-dependent behavior, repeat the relevant check on a supported device. For layout work, label screenshots with state and settings so the next comparison is meaningful. Do not treat one attractive image as evidence for every supported configuration.

5. Close the loop with two explicit outcomes

After the change, capture a new preview using the agreed fixture and a new running-app observation using the matched state. Record remaining differences and whether they are expected. If the app still differs, keep the unresolved input in the handoff instead of adjusting arbitrary padding until one screenshot happens to match.

Through Relayard, request only the preview or Simulator capabilities actually available. An operation marked complete without returned image content is not an image you have inspected. When direct image retrieval is unavailable, use a labeled manual screenshot for the comparison.

Common questions

Does a working preview mean the app is ready?

It supports the configured view case. The real navigation, data loading, persistence and interactions still need checks appropriate to the task.

Should I reinstall the Simulator app to fix every mismatch?

First record the saved state and determine whether it explains the difference. A fresh installation can be a useful separate test, but it may erase the state needed to reproduce the bug.

Sources and next steps

Technical references below were checked on October 9, 2026. The diagnostic sequence, prompts and acceptance criteria are Relayard editorial guidance. Scenarios illustrate a method; they are not reported project test results. Available tools depend on the actual client and setup.

  1. Apple: previews in Xcode
  2. Apple: diagnosing bugs in a running app