markhorrocks markhorrocks - 4 days ago 6
Swift Question

Swift 3 UITableViewAction error Missing argument for parameter rawValue in call

I have the following code4 which worked in Swift 2 but does not work on upgrading the code to Swift 3 / Xcode 8.2

Error:

Missing argument for parameter rawValue in call


Here is my problem code. The error is triggered at line 2.

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
return [UITableViewRowAction(style: UITableViewRowActionStyle(), title: "Remove", handler: { (_, _) -> Void in
// return [UITableViewRowAction(style: UITableViewRowActionStyle(), title: "Remove", handler: { (_, _) -> Void in
self.tableView(self.shoppingCartTableView, commit: .delete, forRowAt: indexPath)
})]
}

Answer

UITableViewRowActionStyle is enum.

Code below should work:

UITableViewRowActionStyle.default

or just

.default
Comments