I just started programming in Swift for iOS and I want to make an app with a table view and a search bar. When you click on a cell there will be played a sound. But when I search, I can't simply use indexPath.row because another song wil be played.
Is it possible to give every UITableViewCell an identifier so I can call a sound by the identifier of the tapped cell?
When you search, you should ideally have another array storing the search results.
Lets say you have 10 cells.
You will have an array of 10 sounds which you will play based on indexPath.row
And you will also have another searchResultsArray which you are using to display the search results.
So, whenever didSelectRow is called, use the new array, and play sound from that array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With