Add a SearchTextChanged event so a non-Compose host can drive the search - #6
Merged
Conversation
solcott
force-pushed
the
feature/search-text-event
branch
2 times, most recently
from
August 14, 2026 15:48
2f07270 to
e942520
Compare
CountryListScreen.State exposes the search box as a TextFieldState, which is snapshot-backed Compose Foundation state. A Compose UI binds it directly — that is the point of the type — but it has no meaning to a host that is not a composition, and the SwiftUI app is one: it owns a plain Swift String. SearchTextChanged is the seam. The presenter routes it through setTextAndPlaceCursorAtEnd, so the TextFieldState stays the single source of truth and a Compose host sharing the presenter would not see a stale search box. The test pins that second part specifically, not just the filtering. This is the only change the other three apps share; they keep binding the TextFieldState and never send the event. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
solcott
force-pushed
the
feature/search-text-event
branch
from
August 14, 2026 16:04
e942520 to
74e24eb
Compare
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.
Stack 2/4 — base
chore/compose-1.12-rc01(#5).CountryListScreen.Stateexposes the search box as aTextFieldState, which is snapshot-backedCompose Foundation state. A Compose UI binds it directly — that is the point of the type — but it has
no meaning to a host that is not a composition, and the SwiftUI app stacked above this is one: it owns
a plain Swift
String.SearchTextChangedis the seam. The presenter routes it throughsetTextAndPlaceCursorAtEnd, so theTextFieldStatestays the single source of truth and a Compose host sharing the presenter would notsee a stale search box. The test pins that second part specifically, not just that filtering works
— it asserts the
TextFieldStateends up holding the same text.Android, web and desktop are unaffected: they keep binding the
TextFieldStateand never send theevent.
Why this is its own PR
It is the only change to code the other three apps share, and it is additive and independently
tested. Worth reviewing without the Apple diff on top of it.
Verification
ktfmtCheckand:presenter:jvmTeston this branch alone.🤖 Generated with Claude Code