Swift 3: UITableViewRowActionStyle () Missing Parameter Error Msg

When I scroll the UITableView cell, the following code is called:

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

    //Problem code
    let delBut = UITableViewRowAction(style: UITableViewRowActionStyle(), title: delete_InLocal) { action, index in
        //Setup

Now that I started migrating to Swift 3, I get an error in UITableViewRowActionStyle ():

Missing argument for 'rawValue' parameter when invoked

Does anyone know what the syntax for Swift 3 is in this situation?

+4
source share
2 answers

Initializers are removed by default from some imported enumeration types in Swift 3.

Use UITableViewRowActionStyle.default(or in your case simply .default) instead UITableViewRowActionStyle().

    let delBut = UITableViewRowAction(style: .default, title: delete_InLocal) { action, index in
+11
source

UITableViewRowActionStyle, . , :

UITableViewRowActionStyle.Default
UITableViewRowActionStyle.Destructive
UITableViewRowActionStyle.Normal 

let delBut = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: delete_InLocal) { action, index in
}

"" ... rawValue: 0,

+2

Source: https://habr.com/ru/post/1653722/


All Articles