Swift 3: UITableViewRowActionStyle() “Missing Parameter” Error Msg

后端 未结 2 401
灰色年华
灰色年华 2021-01-13 06:26

When I swipe a UITableView cell, the below code is called:

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITable         


        
相关标签:
2条回答
  • Use UITableViewRowActionStyle as if its an enum. If you type it you will see multiple options:

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

    Some times only "special" cases are provided in this manner ... and you have to use rawValue: 0 in order to denote default behavior

    0 讨论(0)
  • 2021-01-13 07:00

    Default initializers are removed from some imported enum types in Swift 3.

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

        let delBut = UITableViewRowAction(style: .default, title: delete_InLocal) { action, index in
    
    0 讨论(0)
提交回复
热议问题