Store a closure as a variable in Swift
The compiler complains on var completionHandler: (Float)->Void = {} because the right-hand side is not a closure of the appropriate signature, i.e. a closure taking a float argument. The following would assign a “do nothing” closure to the completion handler: var completionHandler: (Float)->Void = { (arg: Float) -> Void in } and this can be … Read more