SwiftUI - delete row in list with context menu - UI glitch

后端 未结 2 1875
夕颜
夕颜 2021-02-10 16:50

I\'ve a array of items displayed using List in my SwiftUI View. I tired to add a contextMenu to delete individual items in the List<

2条回答
  •  忘了有多久
    2021-02-10 17:19

    It’s an issue with SwiftUI, hopefully Apple fix it in the next major release. For now you can solve the issue by adding a small delay before actions are performed in your context button action:

    DispatchQueue.main.asyncAfter(deadline: .now() + 0.7){
        //delete row
    }
    

提交回复
热议问题