Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Void() in Swift 4 mean in PromiseKit?

What does Void in Swift 4 mean? If I have a function to fulfill, as follows:

func someFunc() -> Promise<Void> {
    fulfill()
}

an error shows, and it only works if:

fulfill(Void())

Note. Swift 3 supported:

fulfill()

I am using Swift 4, but can someone help explain why Void in Swift 4 has a constructor?

like image 408
lePapa Avatar asked Oct 29 '25 17:10

lePapa


1 Answers

Void is defined as an empty tuple in Swift. You can take a look swift-void.

like image 156
Enea Dume Avatar answered Oct 31 '25 09:10

Enea Dume



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!