Skip to content

Make @ViewBuilder trailing parameter positioning opt-in via .viewBuilderTrailing#5

Merged
kylebshr merged 5 commits into
mainfrom
claude/optional-view-builder-positioning-BoYvp
Apr 11, 2026
Merged

Make @ViewBuilder trailing parameter positioning opt-in via .viewBuilderTrailing#5
kylebshr merged 5 commits into
mainfrom
claude/optional-view-builder-positioning-BoYvp

Conversation

@kylebshr
Copy link
Copy Markdown
Owner

@kylebshr kylebshr commented Apr 11, 2026

Previously, @Slots always reordered generated init parameters by tier (values,
closures, then @ViewBuilder), which doesn't always match the author's intent.
Now declaration order is preserved by default. Use @Slots(.trailingViewBuilders)
to opt in to the old behavior when trailing closure syntax is desired.

https://claude.ai/code/session_01FLoLtxvKf5acuAYipuYwka

claude added 5 commits April 11, 2026 18:39
…derTrailing

Previously, @Slots always reordered generated init parameters by tier (values,
closures, then @ViewBuilder), which doesn't always match the author's intent.
Now declaration order is preserved by default. Use @Slots(.viewBuilderTrailing)
to opt in to the old behavior when trailing closure syntax is desired.

https://claude.ai/code/session_01FLoLtxvKf5acuAYipuYwka
Update unit and integration tests to match the new default behavior where
parameters preserve declaration order instead of being sorted by tier.

https://claude.ai/code/session_01FLoLtxvKf5acuAYipuYwka
The ToolbarRow preview passed title before leading, but with declaration
order preserved, leading (idx 0) now comes before title (idx 1).

https://claude.ai/code/session_01FLoLtxvKf5acuAYipuYwka
…rder

The test now verifies declaration order is preserved, not that closures
get reordered.

https://claude.ai/code/session_01FLoLtxvKf5acuAYipuYwka
@kylebshr kylebshr merged commit dbfc0ab into main Apr 11, 2026
1 check passed
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.

2 participants