Hi everyone
I would like to know is there anyway that we can loop through an array of items using indexPath and pass it to the collection View.
As collection view has section and row as IndexPath,is there any way to loop through a single dimension array?
Cause this can be done simply with table view, so I hope there is a solution to this.
Edit:
Just say for an example I have an array of 20 strings. If I want to loop through each of the string to be label for the table view, I use the function cellForItemAtIndexPath and I will use the indexPath.row to loop through each item eg(string[indexPath.row]). This can be done like this for tableView. However, collections seems a bit more complicated as when I use the cellForItemAtIndexPath, it doesnt return only row column as indexPath, but also the section column. So I will not be able to just loop though using eg.(string[indexPath.row]). I was wondering is there any easier method to overcome this?
Thank you