I have a closure defined like this,
public var onLogCompletion:((_ printLog:String,_ fileName:String,_ functionName:String,_ lineNumber:Int) -> ())? = nil
Which is updated like this,
fileprivate func printerCompletion(printLog:String, fileName:String, functionName: String, lineNumber:Int) -> Void {
if onLogCompletion != nil {
onLogCompletion!(printLog, getFileName(name: fileName), functionName, lineNumber)
}
}
And using it like this,
Printer.log.onLogCompletion = { (log) in
//print(log)
//print(log.0)
}
Error:
Cannot assign value of type '(_) -> ()' to type '((String, String, String, Int) -> ())?'
But this is giving me above error and not sure what to do?
The same is working fine with Swift 3.x.