-2

I got an array with objects, and populate the collection view with them. For example I have 3 objects inside my collection view. Is there a way, to receive the current index path based on the object name?

Thanks

Antonio K
  • 144
  • 11

1 Answers1

5
let indexPath = objects.index(where: {
    $0.name == "value"
}).flatMap({
    IndexPath(row: $0, section: 0)
})
Callam
  • 11,409
  • 2
  • 34
  • 32