Swift - Closure cannot have keyword arguments. Error in Xcode 7.3

I updated Xcode 7.3, and some of my libraries, including Toast and CNPopupButton , give me this error: Closing cannot contain keyword arguments

And then he asks me to remove the Type Name argument.

enter image description here

What could be the problem?

+7
api xcode swift
source share
1 answer

Since Swift 2.2 (which comes with Xcode 7.3), this declaration is like:

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

it should be

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

Which really feels more swift-ish. If you do not want to specify a type, you can also use a short syntax:

 button.selectionHandler = { button in 
+5
source share

All Articles