Skip to content

fix(examples/swift): fix ChatGPTStyleChat launch issue and polish UI - #611

Merged
cornelcroi merged 3 commits into
mainfrom
fix/swift-example-launch-and-ui
Jul 15, 2026
Merged

fix(examples/swift): fix ChatGPTStyleChat launch issue and polish UI#611
cornelcroi merged 3 commits into
mainfrom
fix/swift-example-launch-and-ui

Conversation

@cornelcroi

Copy link
Copy Markdown
Collaborator

Issue Link

Fixes #610

Summary

  • Fix Xcode project so the app actually launches in the simulator
  • Redesign chat UI and order card widget with Apple-style visuals
  • Handle out-of-scope queries gracefully in the gatherer prompt

Changes

project.pbxproj — Added missing PBXFileReference for ChatGPTStyleChat.app, populated the empty Products group, and added productReference to the native target. Without these three entries the scheme executable was "None" and the app never launched after a successful build.

ChatGPTStyleChat.xcscheme — Replaced hardcoded OpenAI API key with YOUR_OPENAI_API_KEY placeholder.

ChatView.swift — iMessage-style gradient bubbles (indigo→purple for user, system card for assistant), material blur header with contextual toggle icon, pill-shaped composer with arrow.up.circle.fill send button; Return key now sends the message.

OrderCardView.swift — Status-colored gradient header (green/blue/orange/red keyed on status string), "Live widget" badge so the card is clearly not a chat bubble, SF Symbols for shipping/calendar/truck, dot-list items panel, matching gradient Refresh button.

ChatViewModel.swift — Gatherer prompt now explicitly handles out-of-scope queries (jokes, weather, general chat) with a natural explanation instead of recycling the last tool result.

User experience

Before: open .xcodeproj → build succeeds → nothing launches. Widget is an unstyled white card.

After: open → build → simulator boots and app appears. Chat looks like a real iOS messaging app. The order card is visually distinct with status-appropriate colors. Off-topic questions get a clean "outside my scope" reply.

Checklist

  • No framework code touched — example only
  • Hardcoded API key removed from scheme
  • Tested on iPhone 17 Pro simulator (iOS 26.4.1 / Xcode 26)

Code written by Claude (claude-sonnet-4-6), architected and approved by @cornelcroi.

- project.pbxproj: add missing productReference + PBXFileReference for
  ChatGPTStyleChat.app and populate the empty Products group — without
  these the scheme executable is "None" and the app never launches after
  a successful build
- ChatView: iMessage-style gradient bubbles (indigo→purple for user,
  system card for assistant), material header with contextual toggle icon,
  pill composer with arrow.up.circle.fill send button activated by Return
- OrderCardView: status-colored gradient header, "Live widget" badge,
  SF Symbols (shippingbox, calendar, truck), dot-list items panel,
  matching gradient Refresh button; accent color + icon keyed on status
- ChatViewModel: gatherer prompt now handles out-of-scope queries with a
  natural explanation instead of recycling the last tool result

Fixes #610

Code written by Claude (claude-sonnet-4-6), architected and approved by @cornelcroi.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d422df76bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +56 to +57
value = "YOUR_OPENAI_API_KEY"
isEnabled = "YES">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disable placeholder API key environment variable

With this enabled scheme variable, users who follow the documented option to paste their key into Config.swift still get OPENAI_API_KEY=YOUR_OPENAI_API_KEY, because Config.openAIKey prefers any non-empty environment value. In that setup the app launches but every model call uses the literal placeholder and fails until the scheme is edited, so either leave this disabled or make the config ignore the placeholder.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed in cd2ecd7 — env var is now disabled in the scheme so it no longer shadows a key set in Config.swift.

CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = 3S2T8KU6X4;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid hard-coding the signing team

This hard-codes every clone of the sample to Apple team 3S2T8KU6X4. When someone runs the app on a physical device or archives it with their own Apple account, Xcode will try to provision for this team and fail unless they manually change Signing settings; the sample previously left team selection to the user/Xcode. Please leave DEVELOPMENT_TEAM unset or move it to a user-local config.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cd2ecd7DEVELOPMENT_TEAM removed from both Debug and Release build configurations.

Replace indigo/purple gradient on user bubbles with iMessage blue
(0.0, 0.48, 1.0) and match toggle + send button to the same color.
The status-colored widget card is now the only other accent on screen —
two colors, two purposes, no visual clash.

Code written by Claude (claude-sonnet-4-6), architected and approved by @cornelcroi.
…, remove team ID

- Scheme: set OPENAI_API_KEY env var to isEnabled=NO so the placeholder
  does not shadow a key pasted in Config.swift
- project.pbxproj: remove hardcoded DEVELOPMENT_TEAM so cloners are not
  locked to a specific Apple team ID

Code written by Claude (claude-sonnet-4-6), architected and approved by @cornelcroi.
@cornelcroi
cornelcroi merged commit ca4cccb into main Jul 15, 2026
8 checks passed
@cornelcroi
cornelcroi deleted the fix/swift-example-launch-and-ui branch July 15, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(examples/swift): ChatGPTStyleChat example doesn't launch + UI needs polish

1 participant