Last Updated on March 13, 2022 by Deya Eldeen
Void is a data type that is common across a lot of programming languages, in Swift’s standard library, it’s simply an empty tuple, it’s used for for functions that return nothing, when defining a function, if you don’t specify a return type, you get a function that return Void, this is how it’s defined in standard library.
public typealias Void = ()
You use Void to declare the type of a function, method, or closure, Keep in mind 🤓
that () can mean two things:
() can be a type – the empty tuple type, which is the same as
() can be a value – an empty tuple, which is the same as