Using Swift 3
I have set up a collectionView with 7 sections - when user taps a cell(button) a specific sound will play from an array of sounds.
So how do I split up the sections in the collectionView to match a specific array of sounds?
for instance
1) sounds in soundArray1 will play when users tap cells(buttons) in section 1 of collectionView
2) sounds in soundArray2 will play when users tap cells(buttons) in section 2 of collectionView
3) sounds in soundArray3 will play when users tap cells(buttons) in section 3 of collectionView
all the way up to section 7.
Here is the current code when user taps cellButton
@IBAction func cellButton(_ sender: AnyObject) {
let sound = (sender as! UIButton).tag
self.setupAudioPlayer(file: peopleSounds[sound] as NSString, type: ".m4a")
self.soundPlayer.play()
}
where peopleSounds is my first array of sounds for section 1 in the collectionView which works perfectly in order - but this peopleSounds array is also called for every other section in the collectionView at the moment
so how do I now make my second array of sounds play when user taps buttons in section 2 of collectionView etc up to section 7?
thank you