Render ProgressView and Toggle#12
Merged
Merged
Conversation
Determinate progress uses the horizontal track and indeterminate progress the platform spinner; the two are separate widgets because the track is only selectable through a style attribute at construction.
Supplied as the default toggle style rather than a primitive conformance, so the binding round-trips and .toggleStyle(_:) keeps working.
The key traps without one, and is read whenever a toggle is in the view tree rather than only when its body is evaluated.
The view builder no longer caps a block at ten children, so the sections no longer need to be split into separate views.
The app links against `libSwiftJava.so` at runtime and fails to start when only `libSwiftAndroidApp.so` is copied.
colemancda
force-pushed
the
feature/form-controls
branch
from
July 22, 2026 14:30
fb90a59 to
4cc8229
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.
First half of the form controls work:
ProgressViewandToggle.Stepper,Slider,TextField, andPickerfollow separately.Rebased onto master now that PureSwift/Android#45 has merged — the
ProgressBarbinding fix this depends on is upstream, so this no longer carries any external blocker.ProgressView
_FractionalProgressViewand_IndeterminateProgressVieware the renderer hooks the default progress style already emits, so both get a primitive conformance backed byProgressBar.Determinate and indeterminate progress are separate widgets rather than one widget toggling
setIndeterminate, because the horizontal track is only selectable through a style attribute at construction time — which is what needed the upstream binding fix, sinceProgressBarhad no constructors at all. Progress is reported on a fixed integer scale sinceProgressBarworks in whole steps whileProgressViewreports a fraction.Toggle
Rendered as a Material switch, bound to its
Bool.This is supplied as the default toggle style rather than as a primitive conformance on
Toggle. A primitive conformance looks like it should work, butToggledeclares@Environment(\.toggleStyle), which is read during environment injection whether or not the body is ever evaluated — and_ToggleStyleKeytraps unless the renderer supplies a default. That crashed on launch. Going through the style system fixes the crash and has the side benefit that.toggleStyle(_:)keeps working.The checked-change callback needs a new JNI bridge,
CompoundButtonOnCheckedChangeListener, followingViewOnClickListenerexactly. The listener guards against writing back when the value already matches, so the reconciler setting the checked state during an update doesn't churn the binding.Build script
build-swift.shcopied onlylibSwiftAndroidApp.sointojniLibs. After the upstream linking changes the app also loadslibSwiftJava.soat runtime and dies on startup withUnsatisfiedLinkErrorwithout it, so the script now copies every built shared library. This is unrelated to the controls themselves but breaks any fresh build, so it is fixed here.Verification
On the emulator, against the merged upstream bindings, via a new Controls gallery screen:
@State, with a label reflecting it.The gallery screen is a flat eleven-child block, which also exercises the view builder change from #11.