Post

Replies

Boosts

Views

Activity

SwiftUI List insertion changes aren't animated on macOS 15
I've been struggling with this issue since the release of macOS 15 Sequoia. I'm wondering if anyone else has encountered it or if anyone has a workaround to fix it. Inserting a new element into the array that acts as data source for a SwiftUI List with a ForEach is never animated even if the insertion is wrapped in a withAnimation() call. It seems that some other changes can be automated though: e.g. calls to shuffle() on the array successfully animate the changes. This used to work fine on macOS 14, but stopped working on macOS 15. I created a very simple project to reproduce the issue: import SwiftUI @main struct TestApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct IdentifiableItem: Identifiable { let id = UUID() var name: String { "Item \(id)" } } struct ContentView: View { @State var items: [IdentifiableItem] = [ IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), IdentifiableItem(), ] var body: some View { List { ForEach(items) { item in Text(item.name) } } Button("Add Item") { withAnimation { items.insert(IdentifiableItem(), at: 0) } } Button("Shuffle Items") { withAnimation { items.shuffle() } } } } How to reproduce Copy the code below in an Xcode project. Run it on macOS 15. Hit the "Add Item" button Expected: A new item is inserted with animation. Result: A new item is inserted without animation. How to prove this is a regression Follow the same steps above but run on macOS 14. A new item is inserted with animation.
1
1
211
Oct ’24