Search code examples
iosvoidswift4promisekit

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?


Solution

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