Skip to content

fix(examples): horizontal URL carousel, typing-avatar alignment, streaming auto-scroll#17

Merged
Zakariya1057 merged 2 commits into
mainfrom
fix/swiftui-examples-rich-content-ui
Jun 2, 2026
Merged

fix(examples): horizontal URL carousel, typing-avatar alignment, streaming auto-scroll#17
Zakariya1057 merged 2 commits into
mainfrom
fix/swiftui-examples-rich-content-ui

Conversation

@Zakariya1057
Copy link
Copy Markdown
Collaborator

What

Fixes three rich-content UI bugs in the SwiftUI example ladder, bringing the affected examples in line with the 06-FullReference reference. UIKit already handled all three correctly (verified — no changes needed there).

Bug Examples fixed
1. URL attachments rendered as a tall vertical stack instead of a horizontal swipeable carousel 03, 04, 05
2. Typing-indicator avatar misaligned — hugged the far-left edge, ~16pt left of message avatars 02, 03, 04, 05
3. Streaming auto-scroll froze mid-stream — only tracked messages.count, not growing text 02, 03, 04, 05

Why

  • URL carousel: URL link-cards were laid out in a VStack { ForEach { URLCard } }. A 12-item reply became an endless vertical scroll. Wrapped them in ScrollView(.horizontal) { HStack(spacing: 10) … } (mirrors the image carousel + UIKit's urlCarousel).
  • Typing avatar: the typing indicator is rendered separately from MessageBubbleView, which applies .padding(.horizontal) to every row. The indicator was missing it, so its avatar sat ~16pt further left than every agent message avatar. Added matching padding.
  • Streaming scroll: streaming grows the last message's text in place without changing messages.count, so the existing .onChange(of: messages.count) never re-fired. Added .onChange(of: session.lastAgentMessage?.text.count) and a shared scrollToBottom(_:) helper (with a 0.1s settle re-scroll to catch the bubble growing taller).

Testing

  • StandardSwiftUI, RichContentSwiftUI, ResilienceSwiftUI, HandoffSwiftUI all BUILD SUCCEEDED.
  • Verified live on 03-RichContent against the dev backend: horizontal URL carousel swipes, typing avatar aligns with message avatars, and the view follows a long streamed reply to the bottom.
  • Each fix is identical across the affected examples.

Scope

SwiftUI example source only (ContentView.swift / MessageBubbleView.swift). No SDK, signing/DEVELOPMENT_TEAM, connector-token, or .pbxproj changes included.

…aming auto-scroll

Three SwiftUI rich-content UI bugs, brought in line with the 06-FullReference
reference (UIKit already handled all three correctly):

1. URL attachments rendered as a tall vertical stack instead of a horizontal
   swipeable carousel. Wrapped the URLCard ForEach in a horizontal ScrollView
   (matches the image carousel + UIKit's urlCarousel). [03, 04, 05]

2. Typing-indicator avatar hugged the far-left edge — the indicator is rendered
   outside MessageBubbleView and was missing the .padding(.horizontal) that every
   message bubble has, so it sat ~16pt left of the message avatars. [02, 03, 04, 05]

3. Streaming auto-scroll only fired on messages.count changes. Streaming grows the
   last message's text in place without changing the count, so the view froze
   mid-stream. Added an onChange on the last agent message's text length plus a
   shared scrollToBottom() helper with a settle re-scroll. [02, 03, 04, 05]
Keep the docs 1-1 with the example code after the rich-content fixes:

- Root README + 03-RichContent README: render URL link-cards in a horizontal
  ScrollView carousel (matching the image carousel), not a vertical stack.
- 02-Standard README: typing indicator gets .padding(.horizontal) so its avatar
  lines up with the message bubbles.

Streaming auto-scroll docs (01-Hello, 06-FullReference) already documented the
count + text-length pattern, so no change needed there.
@Zakariya1057 Zakariya1057 merged commit 5d54cd5 into main Jun 2, 2026
3 checks passed
@Zakariya1057 Zakariya1057 deleted the fix/swiftui-examples-rich-content-ui branch June 2, 2026 15:38
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.

1 participant