Add ZStack and lift the view builder child limit#10
Merged
Conversation
Replaces the arity-specific initializers with a single variadic one.
Parameter packs replace the fixed set of arity-specific buildBlock overloads, so a view builder now accepts any number of children.
Children overlay one another in declaration order, positioned by the stack's alignment. The alignment is retained as the container's coordinator so the renderer can apply it to each child's layout parameters.
This was referenced Jul 22, 2026
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.
Stacked on top of #9 — review that first; this PR targets
feature/modifiersand will retarget tomasteronce #9 merges.ZStack
ZStackhad no Android renderer. It now renders as aFrameLayout, overlaying children in declaration order.Alignment needs a little indirection:
FrameLayoutpositions children through their own layout parameters rather than a container-wide gravity, and the renderer only has the parent's native view to work from when it mounts a child. The stack's gravity is therefore retained as the container's coordinator and read back when assigning each child's parameters. Only containers carrying a retained gravity get this treatment, so the frame layouts used for sheets and fragment hosting are untouched.Children hug their content rather than filling the container, which is what gives the alignment room to act.
View builder child limit
@ViewBuilderwas capped at ten children by a fixed set of arity-specificbuildBlockoverloads. Parameter packs replace all of them with one variadic overload, andTupleView's ten arity-specific initializers likewise collapse into a single variadic one. The empty and single-childbuildBlockoverloads stay as they are, so a lone child still passes through unwrapped.The stacks gallery screen now declares thirteen children in one
VStack, which previously did not compile.Verification
On the emulator:
.center,.topLeading, and.bottomTrailing.