Implement and debug · XCODE / CHATGPT

Add a Feature to an Existing iOS App with ChatGPT

Plan one complete feature inside an existing SwiftUI app without turning it into a rewrite. Define data ownership, failure behavior, scope and acceptance before editing.

Describe a complete user outcome and the boundaries around it. Ask ChatGPT to inspect the existing implementation, then deliver the smallest end-to-end slice that includes state, storage, UI and verification where required. A new button alone is not a completed feature.

1. Replace a vague request with a feature contract

“Add favorites” can mean a temporary toggle, a persistent local list or account-synced data. Those have different implementation costs. In this example, the requirement is local favorites that survive relaunch, appear consistently in the detail and list screens, and have an empty state. Account sync is outside scope.

Write the desired behavior as observable rules. Decide what happens when an item is deleted, a save fails or a user taps twice quickly. You do not need to design every future feature; resolve the choices that change this implementation.

2. Inspect the existing path from model to screen

Ask ChatGPT to locate the item model, persistence layer, list screen, detail screen and relevant tests. Have it explain the current source of truth before proposing files. Reuse the project’s established storage and dependency patterns unless there is a concrete reason they cannot support the feature.

If implementation adds files, inspect how the Xcode project organizes and includes them. [1] A source file created in the repository is not by itself a verified part of the intended app. Preserve unrelated local edits and identify any data migration before writing it.

3. Define acceptance before implementation

Illustrative local-favorites contract
ScenarioExpected resultEvidence to collect
Favorite from detailThe list shows the same item as favoritedRun both screens with the same record.
RelaunchThe chosen state remainsTerminate and relaunch with the same stored data.
Remove last favoriteA useful empty state appearsOpen the filtered list after removal.
Save failureThe interface follows the agreed recovery ruleInject a failure in a suitable test setup.
Unrelated workflowExisting list navigation still worksReplay the original selection path.

These are proposed criteria, not measured results. Choose the failure policy explicitly: for example, revert the optimistic change and present a retry. If failure injection is unavailable, mark that scenario unverified rather than inventing a passing result.

4. Deliver one working slice before expanding

Implement the model-to-screen path for one item first. Review the diff and run the core scenario before adding optional sorting, animation or extra controls. A complete small slice exposes integration assumptions earlier than building every screen against temporary data.

Keep the project brief in the conversation so follow-up turns refer to the same boundaries. If a new request changes the contract, update the acceptance criteria deliberately. This helps a limited message budget advance a feature rather than repeatedly rediscovering its scope.

TRY THIS IN CHATGPT
Add local favorites to this existing app. First inspect its model,
storage, list, detail screen and tests. Reuse the current architecture.
Required: both screens agree, favorites survive relaunch, removing
the last favorite shows an empty state, and save failure is handled.
Out of scope: account sync, redesign and unrelated refactors.
Propose the data flow and acceptance checks, then implement one
complete slice. Report actual build/test/manual results and gaps.

5. Report what is ready and what remains

Finish with changed files, design choices that matter to maintenance, build outcome and acceptance results. Xcode provides test-result inspection for the tests actually executed. [2] Link those results to the scenarios they cover instead of saying only “tests passed.” List manual checks separately.

When Relayard exposes the required local operations, use it to inspect and verify the existing project. When an operation is unavailable, provide an exact manual step. Neither a connection nor a model’s confidence removes the need to check persistence and failure behavior in your app.

Common questions

Should I ask for the entire feature in one message?

You can provide the complete goal and acceptance in one brief. Delivery may require several iterations depending on dependencies, tools and what verification reveals.

When is a larger refactor justified?

When the current structure creates a demonstrated blocker or unacceptable risk. Explain that constraint and review the expanded scope before mixing it into the feature.

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: managing project files and folders
  2. Apple: running tests and interpreting results