I am trying to sort elements into a two dimensional array I built this way, but when the code gets to the 2D array I get an error: \"array out of index\".
for x in categories{
for y in array{
if x == String(stringInterpolationSegment: y.categoryName){
var tempArray: [ProductCatalogue] = [y]
categoryTempArray.append(tempArray)
j++
}
}
i++
}
then i can use array like this categoryTempArray[i][j]