-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Icon.Content
and replace it with ViewBuilder parameters
#597
Merged
PavelHolec
merged 10 commits into
main
from
525-remove-iconcontent-and-replace-it-with-viewbuilder-parameters
Jun 20, 2023
Merged
Remove Icon.Content
and replace it with ViewBuilder parameters
#597
PavelHolec
merged 10 commits into
main
from
525-remove-iconcontent-and-replace-it-with-viewbuilder-parameters
Jun 20, 2023
Conversation
This file contains 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
Closed
PavelHolec
force-pushed
the
525-remove-iconcontent-and-replace-it-with-viewbuilder-parameters
branch
2 times, most recently
from
June 16, 2023 11:20
fd8b2ed
to
3191cff
Compare
sjavora
reviewed
Jun 20, 2023
PavelHolec
force-pushed
the
525-remove-iconcontent-and-replace-it-with-viewbuilder-parameters
branch
from
June 20, 2023 12:02
17b3a5e
to
a19eae5
Compare
sjavora
approved these changes
Jun 20, 2023
PavelHolec
deleted the
525-remove-iconcontent-and-replace-it-with-viewbuilder-parameters
branch
June 20, 2023 13:34
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.
This is another task to make call site being able to inject any
@ViewBuilder
and make our wrapper components more simple and flexible. Now it is updated only for Icons, but follow-up tasks will clean up "disclosure", "buttons" and similar component properties.The
@ViewBuilder
Icon
closure differs based on components - sometimes, the component does not make sense without an icon, in which case, the closure is not optional.For some components in future that would contain a large amount of
ViewBuilders
, we may even extract optional disclosure and other subviews as modifiers, similar totoolbar()
modifier.Inspiration from SwiftUI components
In general, most, if not all, SwiftUI components and modifiers follow these principles:
Label("label", icon:)
vs.frame(width:, height:)
)onCancel
)icon
)Label
A title is the primary information (goes first), an icon is secondary. The component is correctly able to detect
EmptyView
to avoid empty space in the HStack (we are doing the same in components that use Icon, although without access to internals of viewbuilder layout, we cannot correctly detect if/else/foreach empty cases).DisclosureGroup
The primary "content" goes as a first @ViewBuilder.
PayWithApplePayButton
Actions go first, then @ViewBuilders