withAnimation(_:completionCriteria:_:completion:)
Returns the result of recomputing the view’s body with the provided animation, and runs the completion when all animations are complete.
Declaration
func withAnimation<Result>(_ animation: Animation? = .default, completionCriteria: AnimationCompletionCriteria = .logicallyComplete, _ body: () throws -> Result, completion: @escaping () -> Void) rethrows -> ResultDiscussion
This function sets the given Animation as the animation property of the thread’s current Transaction as well as calling Transaction/addAnimationCompletion with the specified completion.
The completion callback will always be fired exactly one time. If no animations are created by the changes in body, then the callback will be called immediately after body.