Q:

IOS - Capture event on button pressed and pass to tableview

I’m trying to capture an event from a button pressed so I can pass it to a table view, its a timer where I can capture the time and pass it to the tableview but I can't seem to be able to capture the event type.
In the example below I can capture the time a goal was scored but I need the words Goal also passing to the tableview
 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: "cell")

        cell.backgroundColor = self.view.backgroundColor

        **cell.textLabel?.text = "Help here to capture the button event"**
        cell.detailTextLabel?.text = time[indexPath.row]

        return cell
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return time.count
    }

@IBAction func goalClicked(_ sender: UIButton) {

    let stopWatchString = stopWatch.elapsedTimeSinceStart()
    stopwatchLabel.text = stopWatchString

    time.insert(stopWatchString, at: 0)
    self.tableView.reloadData()        
}

Thanks

A:

Sorted it.
var event: String!

then in the tableView
cell.textLabel?.Text = event

Finally in the button function
event = "Goal"
tableView.reloadData()

