ale00 ale00 - 5 months ago 395
Swift Question

Swift 3 error "Cannot call value of non-function type 'UITableView!'"

I'm trying to call the superclass' method tableView(_:editActionsForRowAt:indexPath:) but I get "Cannot call value of non-function type 'UITableView!'"

class TextTableViewController: UITableViewController {

override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
super.tableView(UITableView, editActionsForRowAt: IndexPath)

let EditAction = UITableViewRowAction(style: .normal, title: "Edit") { (UITableViewRowAction, IndexPath) in
...
}

return [EditAction]
}
}


Sorry for my English, I'm italian.

Answer
override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
    super.tableView(UITableView, editActionsForRowAt: IndexPath)

When you call a function, you do not pass a type but a value of that type:

override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
    super.tableView(tableView, editActionsForRowAt: indexPath)