jonpeter jonpeter - 14 days ago 5
Swift Question

How to display the values of each array in larger array?

I have

var array = [["Chinese"],["Italian"],["Thai"]]

and I'm looking to set the names of these three array values to label in a table list.

I simply can't set my

cell.namelabel.text = array.string

or something like that.

Would anyone be able to recommend a solution?


- A quick and dirty way to get it done is here.....

var array = [["Chinese"],["Italian"],["Thai"]]
cell.namelabel.text = array.string  = array[0][0]

- One can also iterate using for-in over the Array of Arrays (ie. array) here and access them but thats just one way to do it.

- One can also try to fetch all the values in the array to a single dimension array, so the access gets easier if thats the motive of the code.

var array = [["Chinese"],["Italian"],["Thai"]]

 var valArray: [String] = []

 for value in array
     for innerValue in value