I am trying to store an int value inside a tuple array. The array has this format:
var array: [(object1:Object1,object2:Object2,number:Int)]
I have a tableview, with buttons and textfields inside it's cells. In a button, with an action sheet string picker i give values to the textFields.
func buttonPressed(){
let cell = button.superview?.superview? as? CustomCellClass
//i use a string picker to fill the JVFLoatLabeledTextField
// then i acces link the arrays, index to the current cell
let currentIndex = tableView.indexPath(for: cell)
array[currentIndex.row].number = Int(cell.textfield.text!)!
//i also insert the objects in the array, but they work fine
}
but when i try to acces all the stored data from different cells like this:
for tuple in array {
print(tuple.object1.name)
print(tuple.object2.name)
print(tuple.number)
}
the output will be: object1.name, object2.name, 0 .... every tuple.number has the value 0.
If anyone gives any suggestion I'd appreciated it...