The problem is that closures have an automatic return when there is no explicit return. In this case, the return value is Void? , since there is an optional chain. You can fix this by returning as the last statement:
form.testClosure { form.delegate?.formDidFinish(form) return }
or return testClosure Void?
class Form { var delegate: FormDelegate? func testClosure(sender: () -> Void?) { } }
source share