Updating the root view of UIHostingController with animation

I'm trying to update the root view of a UIHostingController but this happens without animation.


lazy var hostingController = UIHostingController(rootView: ContentView(value: value))

func handleTap() {
  let value = ...
  withAnimation {
    hostingController.rootView = ContentView(value: value)
  }
}

How and where do you call handleTap ?


You define no animation. What effect do you expect ?


And please, show more code.

Updating the root view of UIHostingController with animation
 
 
Q