I have a tableView with cells of products, and when a cell is selected I want the name of the cell to be added to another array and be separated with "" and ,
The array for the tableView is "a", "b", "c" etc..
var name = ""
var arrayOfNames = ""
tableView
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
name = sections[indexPath.section].productName[indexPath.row]
arrayOfNames += name
print(arrayOfNames)
}
So when the cell is pressed it's printing "abc" whereas I want "a", "b", "c"