Remove specific object from array in swift 3

后端 未结 3 424
无人及你
无人及你 2020-12-29 05:43

\"Remove

I have a problem trying to remove a specific object from an array in Swift

3条回答
  •  再見小時候
    2020-12-29 06:08

    According to your code, the improvement could be like this:

        if let index = arrPickerData.index(where: { $0.tag == pickerViewTag }) {
            arrPickerData.remove(at: index)
            //continue do: arrPickerData.append(...)
        }
    

    The index existing means Array contains the object with that Tag.

提交回复
热议问题