SplitView icon indicating copy to clipboard operation
SplitView copied to clipboard

Fraction animation

Open artemkrachulov opened this issue 1 year ago • 1 comments

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.

artemkrachulov avatar May 18 '24 13:05 artemkrachulov

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 https://github.com/stevengharris/SplitView/issues/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.

stevengharris avatar May 18 '24 23:05 stevengharris