SwiftUI ForEach index out of range error when removing row

前端 未结 3 892
日久生厌
日久生厌 2021-01-06 00:39

I have a ForEach block and a Stepper embedded in a List view. The contents of the List view\'s first section is as follow

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-06 01:37

    I had a same problem i solve with adding if condition before ForEach.

    if (!IsDeleting) {
      ...
      .OnDecrement{
         IsDeleting := true
       }
    }
    

    any better solution?

提交回复
热议问题