fix(examples): horizontal URL carousel, typing-avatar alignment, streaming auto-scroll#17
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes three rich-content UI bugs in the SwiftUI example ladder, bringing the affected examples in line with the
06-FullReferencereference. UIKit already handled all three correctly (verified — no changes needed there).messages.count, not growing textWhy
VStack { ForEach { URLCard } }. A 12-item reply became an endless vertical scroll. Wrapped them inScrollView(.horizontal) { HStack(spacing: 10) … }(mirrors the image carousel + UIKit'surlCarousel).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.messages.count, so the existing.onChange(of: messages.count)never re-fired. Added.onChange(of: session.lastAgentMessage?.text.count)and a sharedscrollToBottom(_:)helper (with a 0.1s settle re-scroll to catch the bubble growing taller).Testing
StandardSwiftUI,RichContentSwiftUI,ResilienceSwiftUI,HandoffSwiftUIall BUILD SUCCEEDED.03-RichContentagainst the dev backend: horizontal URL carousel swipes, typing avatar aligns with message avatars, and the view follows a long streamed reply to the bottom.Scope
SwiftUI example source only (
ContentView.swift/MessageBubbleView.swift). No SDK, signing/DEVELOPMENT_TEAM, connector-token, or.pbxprojchanges included.