Skip to content
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 idealSize usage from expanding components #407

Closed
PavelHolec opened this issue Dec 27, 2022 · 0 comments
Closed

Remove idealSize usage from expanding components #407

PavelHolec opened this issue Dec 27, 2022 · 0 comments
Milestone

Comments

@PavelHolec
Copy link
Collaborator

PavelHolec commented Dec 27, 2022

EDIT:

fixedSize modifier works fine only when the size of the component would be indeed smaller than provided size. But it is unusable in situations where long text and/or large accessibility font sizes make the component bigger, because it fixes the size of component no matter what is the the proposed parent size.

NOT DOING:

The idealSize modifier is useful for components that should have fixed size by default, but can be optionally made expandable (Tag).

But for components like Alert or Button, the fixedSize modifier seems to be enough to restrict the size in all variants, even for container components like Alert (containing expanding Button). There might have been an original reason for having it there, but after rechecking, it seems it is not needed there.

Ideally, we would not need the idealSize modifier at all, if this would achieve the same effect of telling the component that it should not fix its own size:

// Expanding Tag (the opposite of calling `.fixedSize()`)
Tag(..)
  .frame(maxWidth: .infinity)

// Default behaviour, fixed Tag
Tag(..)

For that, the component would need to have the knowledge of that and so far I found no way of doing that easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants