CHATGPT CHAT · SWIFTUI · VISUAL EDITING

Edit SwiftUI in your existing Xcode project. Check the real preview.

Start with one clear visual goal. Keep your existing project, then review the source, build and image from the same change.

Keep your existing app. Connect ChatGPT to the Xcode project you authorize, identify the view behind the screen, and make one reviewable SwiftUI change. Then inspect the actual diff, local build result and a fresh preview from that same project.

This workflow needs an available Chat model, image support and the required local tools. A selected screenshot is a starting point—not proof that code changed or that the interface passed verification.

Connect your existing Xcode project · Review the available evidence

Copy the source-mapping prompt · Copy the edit-and-verify prompt

Start with “make this blue button orange”

The reference walkthrough shows a saved-results panel with an Image tab. A developer selects the Add one button in an iPhone preview and asks for an orange button labeled Add 1, keeping the rest unchanged. Pro is selected in the Chat composer.

The useful detail is the combination of a visible target and a narrow instruction. “Which button?” and “what changes?” are both explicit, making the request easier to map to source and verify than “make this screen look better.”

Requested outcome, not a completed before-and-after result
ElementReferenceRequested outcome
Button labelAdd oneAdd 1
Button colorBlueUse the agreed orange
Counter actionExisting actionPreserve its behavior
Other contentTitle, Reset and listKeep unchanged
What does the reference actually prove? The panel says the image and selection were added to the next Chat turn. It also says no message has been sent and model pixel inspection is unconfirmed. It does not show the completed orange button. Selection, source modification and visual acceptance are separate milestones.

1. Bring the image and selection into Chat

  1. Open Image in Relayard’s saved-results panel and confirm it is the screen version you want to change. Use Reload original image if needed.
  2. Drag over the target region, or choose Use full image for more context. Keep enough surrounding layout to identify the button’s row.
  3. Use What should Chat look at? to describe the intended change and what should stay fixed.
  4. Add the context to the next turn, choose Continue in Chat, then send your actual request in the conversation.

The reference panel accepts selection coordinates from 0 to 1. Those describe a location in the original image; they are not SwiftUI padding, frame or offset values. These labels come from the reference interface; availability depends on your version.

If your client does not expose region selection, attach the original image and identify the target by its label, position and neighbors. First confirm that the model actually received and inspected the image.

2. Map the selection to real source code first

The region does not automatically identify a source file. The button could belong to a custom component, have several lookalikes, or appear in an outdated preview. Read the project, then identify the Button label, action and style modifiers before deciding what to change.

TRY THIS IN CHATGPT
Use the image and selected region added to this Chat.
First report what you can actually see. If the image is unavailable,
stop and ask for the original image; do not infer its contents.

Target: the blue “Add one” button in the selected region.
Requested change: orange button, label “Add 1”.
Keep the title, counter behavior, Reset button and list unchanged.

Read-only pass: confirm the current project and available tools.
Read the relevant SwiftUI source and identify the Button and modifiers
that control its label and appearance. Show the smallest proposed patch.
Do not apply edits or run a build in this pass.
If the selected region does not map unambiguously to source, explain why.

3. Keep the change small and preserve the action

Inspect how the color is implemented. Apple’s tint depends on the control’s style and context, so it does not change every button background in the same way. [1] For a custom background, change the appropriate design token; for a system button, preserve the project’s chosen style.

This is a standalone illustration using a prominent system button style, not source retrieved from the pictured project:

Button("Add 1") {
    count += 1 // Keep the project’s existing action here.
}
.buttonStyle(.borderedProminent)
.tint(.orange)
TRY THIS IN CHATGPT
Apply the small change we just reviewed to the same project.
Use the agreed orange design token (or Color.orange if the project has none)
and the “Add 1” label. Preserve the existing action and surrounding layout.

Review the diff, then build the same scheme and destination through
available, authorized tools. Request a fresh preview at the same device,
color scheme, Dynamic Type size and counter state as the reference.
Report: changed files, build result, actual returned image, visible
differences and anything not verified. If interaction tools are available,
check that Add 1 increments once and Reset still resets the counter.
Do not call the visual check complete without inspecting the new image.

4. Pixel-level precision starts with points and pixels

SwiftUI layout uses logical dimensions. The display scale determines how points map to pixels: at a 3× render scale, a length of 12 native image pixels corresponds to 4 pt. [2] That conversion cannot be applied blindly to an image resized in a browser, cropped or exported at a different size.

Do not translate “12 pixels left” directly into .offset(x: -12). Confirm the original render dimensions and scale, then inspect padding, container spacing, alignment and safe-area behavior. Even the 689 × 1500 original-image dimensions shown in the reference do not establish the device or scale by themselves.

A better brief is “preserve the layout, set this button’s horizontal padding to 16 pt and align it with the neighboring primary action.” For a brand color, supply the existing Color asset or design token rather than asking for “a bit more orange.”

5. Render again and compare under the same conditions

Xcode can generate previews of SwiftUI views. [3] In this workflow, obtain the actual updated image and compare it with the reference at the same device and state. A successful build alone does not establish visual correctness.

  • Fix the conditions: device or canvas size, orientation, light/dark appearance, Dynamic Type, language, data state and image zoom.
  • Inspect the target: the label reads Add 1, the color matches the brief, text is not clipped, and the title, Reset button and list remain intact.
  • Check behavior: in a supported Simulator session, verify one increment per tap and a working Reset action. A static Preview is not an interaction test.
  • Check adaptability: after matching the reference, inspect larger text, a narrower device and dark mode so the small fix does not damage the rest of the layout.

If your results panel offers Compare saved images, use it to inspect retained images. Confirm that they are the intended before and after versions, rather than different data states. List missing images, tools or logs as unverified work.

Do you need file edits, or a project verification workflow?

For an edit to a file already open in Xcode, consider ChatGPT for macOS with Work with Apps. OpenAI documents direct IDE file edits and a reviewable diff.

Consider Relayard when you want to stay in a compatible Chat client and use authorized project tools to inspect local build results and returned images. Check your actual tool catalog before relying on a capability. This is a workflow choice, not a claim that only Relayard can edit Xcode.

OpenAI: Work with Apps on macOS

Frequently asked questions

Can ChatGPT edit SwiftUI directly from a screenshot?

A screenshot identifies the visible target, but it does not expose the project’s source code. Direct edits require a client with the appropriate tools and authorization. Relayard connects that client to the selected local Xcode project; the assistant should read the relevant source before proposing a patch.

Does adding an image selection change my code?

No. The reference interface adds the image and selection to the next Chat turn. You still need to send a request in Chat. Reading the image, identifying source, applying a change and verifying the result are separate steps.

Is this a pixel-perfect SwiftUI generator?

No. It is an iterative workflow for precise visual changes to an existing app. A region can guide attention, but matching a screenshot requires the correct device, display scale, data and rendering conditions. It does not guarantee an identical result across devices.

Can I use Pro in Chat rather than Codex?

The reference shows Pro selected in the Chat composer. For your own account, confirm that the selected model is available and can receive the image and call the required Relayard tools. A subscription name alone does not establish tool support or remaining usage.

Can I change spacing, fonts and corner radius as well?

Yes, when the source and available tools support the requested change. Specify one target, a concrete point-based value or design token, and what must stay unchanged. Validate the new preview at the same device and state before widening the change.

What if the old result text has expired?

A saved image and a readable operation result are different evidence. Use an available retained image for visual reference, then inspect the current source and obtain fresh verification for new edits. Do not treat a missing log as proof of either build failure or current success.

Sources and scope

Written by Relayard from an October 9, 2026 reference showing Chat and the saved-results panel. The reference establishes the image-selection handoff interface, not a completed edit. Prompts and code are workflow recommendations and illustrations. Apple documentation was checked on the same date; the official Work with Apps reference supports the file-editing workflow discussed above:

  1. Apple: tint(_:)
  2. Apple: display scale and points
  3. Apple: Previews in Xcode
  4. OpenAI: Work with Apps on macOS