I have a button that is supposed to append the value of the cell's label to an array.
@IBAction func test(sender: AnyObject) {
var cellLabelArray = [""]
cellLabelArray.append(cell.cellLabel.text)
}
I assumed that as the more I selected the button, the longer the array would become.
Like : cellLabelArray = ["label", "label", "label", "label"] if I pressed it four times.
What I'm getting is that it just appends the text label once, what I want is to append multiple times, because the label changes.
it returns something like this: ["label"] no matter how many times I press the button
How would I do this using Swift?