My sample function is this
func temp(type: String, callback: (() -> Void)? = nil) {
callback?()
}
But why can't I do this?
temp(type: "Here", () -> {
print("hey")
})
It says, Expected type after '->'
While this does work
temp(type: "Here", { () -> Void in
print("hey")
})
I find it weird why the () -> Void has to be inside the closure.