Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Remove withAnimation blocks from view models #277

Open
sergeymomot opened this issue Feb 7, 2024 · 1 comment
Open

[iOS] Remove withAnimation blocks from view models #277

sergeymomot opened this issue Feb 7, 2024 · 1 comment
Assignees
Labels
code health Proactive technical investment via refactorings, removals, etc.

Comments

@sergeymomot
Copy link

sergeymomot commented Feb 7, 2024

(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 #276 (comment)

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.

@forgotvas
Copy link
Contributor

Low priority

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Proactive technical investment via refactorings, removals, etc.
Projects
Status: Extended Backlog / Icebox
Development

No branches or pull requests

2 participants