SwiftUI expanding list animation broken on iOS 16.4

573 views Asked by At

I have a SwiftUI expanding list built as shown in this article.

Here is my implementation:

struct ContentView: View {
    
    var movies: [Movie]

    var body: some View {
        List(movies, children: \.movies) { movie in
                Text(movie.title)
        }
    }
}

struct Movie: Identifiable {
    let id: String
    let title: String
    var movies: [Movie]?
}

Here is the animation on iOS 16.1:

List on iOS 16.1

And Since iOS 16.4 the animation is broken:

List on iOS 16.4

Is it a bug on OS level or should I use another technique ?

1

There are 1 answers

2
John On

I have to close List second-level animation for iOS 16.4 with this bug.

List{}.transaction { transaction in
    transaction.animation = nil
}