我正在尝试将项目从Swift 2.3转换为Swift 3。 转换器之前的代码是:
Swift 2.3中的代码
..., handler: { [performSegueWithIdentifier] _ in
performSegueWithIdentifier("Help Segue", sender: nil)
}
转换器之后,在Swift 3.0中,代码变为:
..., handler: { [performSegue(withIdentifier:sender:)] _ in
performSegueWithIdentifier("Help Segue", sender: nil)
}
但我有编译错误:
'Expected 'weak', 'unowned', or no specifier in capture list'
我尝试过:
Expression type 'Void' (aka '()') is ambiguous without more context
。答案 0 :(得分:0)
错误: '表达式''Void'...'与第二行有关:
performSegue(withIdenfifier: "Help Segue", sender: nil)
所以,一切都会变成:
handler: { [performSegue] _ in
performSegue("Help Segue", nil)
})