(not a priority for now)
it's bad practice to use withAnimation block inside view model, better to use animation modifier in that case, something like .animation(.default, value: showError)
In SwiftUI, it is generally recommended to keep the view model separate from the animation logic. The view model’s primary responsibility is to manage the state and business logic of your application, while the animation logic is typically handled within the views themselves.
Instead of using withAnimation inside the view model, a common approach is to expose properties in the view model that represent the state to be animated.
Need to remove withAnimation blocks from view models. All animations should be described inside view.
(not a priority for now) it's bad practice to use
withAnimation
block inside view model, better to use animation modifier in that case, something like.animation(.default, value: showError)
_Originally posted by @forgotvas in https://github.com/openedx/openedx-app-ios/pull/276#discussion_r1479652718_
In SwiftUI, it is generally recommended to keep the view model separate from the animation logic. The view model’s primary responsibility is to manage the state and business logic of your application, while the animation logic is typically handled within the views themselves. Instead of using withAnimation inside the view model, a common approach is to expose properties in the view model that represent the state to be animated. Need to remove withAnimation blocks from view models. All animations should be described inside view.