9

In UIKit you can do something like this:

UIView.animate(withDuration: TimeInterval, animations: {
    //animation
  }) { (Bool) in
    //code which will be executed after the animation
}

Is there anything like that in SwiftUI, or can you think of a replacement?

B.T.
  • 610
  • 6
  • 20
Paul
  • 459
  • 7
  • 14

1 Answers1

1

There is an approach to this described here:

https://www.avanderlee.com/swiftui/withanimation-completion-callback/

The approach requires the use of a custom implementation of the AnimatableModifier protocol. It's not completely trivial to implement, but it does seem to solve the problem.

B.T.
  • 610
  • 6
  • 20