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

Fraction animation #36

Open
artemkrachulov opened this issue May 18, 2024 · 1 comment
Open

Fraction animation #36

artemkrachulov opened this issue May 18, 2024 · 1 comment

Comments

@artemkrachulov
Copy link

Hi, very good solution for splitting views. Can you help to understand one thing about animation. How can I animate fraction value? For example on button tap, animate splitting. Code withAnimation { fraction.value = 0.75 } doesn't work.

@stevengharris
Copy link
Owner

The animation needs to be done in the Split view itself, since it observes the fraction changes:

.onChange(of: fraction.value) { new in withAnimation { constrainedFraction = new } } //<-Line 102

I made this change in #29, but I did not make it animate by default. I suppose that would be consistent with the hide/show defaults. I don't think this has any other weird side-effects, but it's been a while since I looked at it. Let me know if this works for you and if you see any other weirdnesses that might be associated with it. Thanks.

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

No branches or pull requests

2 participants