Advance
Advance copied to clipboard
Spring animation (or any other) won't start after setting target.
HI,
I've been trying for hours to make the animation start, but couldn't. The onChange
method, never gets called.
This is the code:
let spring = Spring(initialValue: 0)
spring.onChange = { [weak view] val in
print("change!") // never gets called.
view?.frame.origin.y = val
}
spring.target = 500
I've tried debugging the whole thing and the simulation function never turns into .animating (state). I can't figure this out.
Tried calling both view.setNeedsLayout()
and view.setNeedsDisplay()
.
What am I missing? Thanks.