Difference between returning Void and () in a swift closure

前端 未结 4 1437
灰色年华
灰色年华 2020-12-25 12:53

Whats the difference between these closures?

let closureA: () -> ()

and

let closureB: () -> Void
4条回答
  •  生来不讨喜
    2020-12-25 13:20

    Same. It's just a typealias so it works exactly the same.

    typealias Void = ()
    

    Sounds like Erica Sadun and Apple are trying to stick with Void: http://ericasadun.com/2015/05/11/swift-vs-void/

提交回复
热议问题