@IBAction func itemsHidden(button: UIButton) { button.hidden = true if let index = item.indexOf(button) { item.removeAtIndex(index) } 

How, in this case, can I use filter with respect to index , which was removed from the array?

I tried:

let filterIndex = item.filter { $0 == index}

but it does not work.

  • You can explain the problem. exactly what you want to get - Max Mikheyenko
  • I want to filter through the filter those elements that were removed through removeAtIndex. - Spartak
  • that is, do you want to find in the array those elements that are no longer in it? originally :) - Max Mikheyenko
  • : / agree) how can such elements be selected? - Spartak
  • create an additional array and when remove elements from the first one, move them to the second one. either (as far as I understand the array consists of UIButton), do not delete, but filter by hidden - Max Mikheyenko

0