Sorry for another dumb question, but I can't find an answer.
I want to know why to access a second node of an array outside of the main.
For exemple, my main:
let myArray = [["Andrea", 39], ["Vera", 70], ["Renata", 42], ["Joao Pedro", 10], ["Felipe", 4], ["Joao", 71]]
//this for work in the main but not in the class
for i in 0...(myArray.count - 1) {
print("Name: \(myArray[i][0]) - Age: \(myArray[i][1])")
}My class:
class AacTestArray: NSObject {
func aacPrintArray(array: Array<AnyObject>) {
let numRow: Int = array.count
//this for doesnt work in the class
for i in 0...(numRow - 1) {
print("Name: \(array[i][0]) - Age: \(array[i][1])")
}
}
}when i use the for inside the class, i get this error on line 7:
Ambiguous use of 'subscript'
Thanks