Swift error - cannot invoke initializer for type int with an argument list of type ()?

Asked

Viewed 77 times

0

I’m doing a course of Swift 2 plus the version I’m using is the 3, so I’m searching the codes when I have some error to make the fix, some more I haven’t found.

I’d appreciate it if someone could help

error: cannot invoke initializer for type int with an argument list of type ()

func tableView(_ tableView: UITableView, cellForRowAtIndexPath  indexPath: IndexPath) -> UITableViewCell {
	let cell = UITableViewCell(style:UITableViewCellStyle.default, reuseIdentifier:"cell")
	
	let timesTabel = Int(btnSliderValor.value = 20) //erro 
	cell.textLabel?.text = String(timesTabel = indexPath.row)
    return cell
	
}

1 answer

0

After reviewing the code, I solved the problem:

func tableView(_ tableView: UITableView, cellForRowAtIndexPath  indexPath: IndexPath) -> UITableViewCell {
    let cell = UITableViewCell(style:UITableViewCellStyle.default, reuseIdentifier:"cell")

    let timesTabel = Int(btnSliderValor.value * 20)
    cell.textLabel?.text = String(timesTabel * (indexPath.row + 1) )
    return cell

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.