Skip to content

A Tour of the Composable Architecture: Part 3 - List does not animate #553

Answered by mbrandonw
jmgawecki asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @jmgawecki, thanks for the question. This is actually due to a change in SwiftUI between iOS 13 and 14. In iOS 13, SwiftUI would implicitly animate a lot of things for you (such as rows in a List) without you needing to do anything in code. But in iOS 14 SwiftUI started requiring you to be more explicit with animations.

There are a few ways you can get animation back. You could tack on a .animation view modifier to the list:

List {
  ForEachStore(
    self.store.scope(state: \.todos, action: AppAction.todo(index:action:)),
    content: TodoView.init(store:)
  )
}
.animation()

This will make it so that the List always animates its contents.

Alternatively, you can be a little bit more fo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jmgawecki
Comment options

Answer selected by jmgawecki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants