I have two type of arrays: one for storage the category name:
struct Category {
var title : String
var dataArrayName : String
}
var Categories = [
Category(title: "First Title", dataArrayName: "firstDataArray"),
Category(title: "Second Title", dataArrayName: "secondDataArray")
]
and another one for storage the category data:
var firstDataArray = [1, 2, 3, 4, 5] // Data Array 1
var secondDataArray = [6, 7, 8, 9, 10] // Data Array 2
Then, in tableView didSelectRowAt indexPath I want to access firstDataArray by dataArrayName from Categories (to push the data array to another View Controller).
I get value of dataArrayName via line Categories[indexPath.row].dataArrayName but I don't know how to access array because I get a String result.