Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift - Closure cannot have keyword arguments Error In Xcode 7.3

Tags:

xcode

swift

api

I have updated to Xcode 7.3 and some of my Libraries including Toast and CNPopupButton are giving me this error: Closure cannot have keyword arguments

And then it asks me to delete the argument Type Name.

enter image description here

What could be the problem here?

like image 633
n.by.n Avatar asked Mar 30 '16 11:03

n.by.n


1 Answers

Since Swift 2.2 (which comes with Xcode 7.3) a declaration like:

button.selectionHandler = { (CNPPopupButton button) -> Void in

should be

button.selectionHandler = { (button : CNPPopupButton) -> Void in

Which indeed feels more Swift-ish. If you don't want to pin down the type, you can also use the short-hand syntax:

button.selectionHandler = { button in
like image 180
Steffen D. Sommer Avatar answered Oct 14 '22 18:10

Steffen D. Sommer