Post

Replies

Boosts

Views

Created

SwiftUI Edit Button not working after animation
After animating from a group conditional view, the edit button on my list doesn't work. It works fine if there's no animation, but I'm not sure why an animation would cause the edit button to not work? struct Overview: View { @State var test = true var body: some View { Group { if test { Button(action: { test = false }) { Text("Button") } } else { NavigationView { SimpleList() .toolbar { ToolbarItem(placement: .navigationBarTrailing) { EditButton() } } } .navigationViewStyle(StackNavigationViewStyle()) } } .animation(.easeOut, value: test) } } struct SimpleList: View { let test = ["1", "2", "3", "4"] var body: some View { List { ForEach(test, id: \.self) { t in Text(t) } .onDelete(perform: deleteRow) } } func deleteRow(_ :IndexSet) { } }
1
0
1.4k
Jan ’22