TypealiasSwift

BooleanLiteralType

The default type for an otherwise-unconstrained Boolean literal.

typealias BooleanLiteralType = Bool

Overview

When you create a constant or variable using one of the Boolean literals true or false, the resulting type is determined by the BooleanLiteralType alias. For example:

let isBool = true
print("isBool is a '\(type(of: isBool))'")
// Prints "isBool is a 'Bool'"

The type aliased by BooleanLiteralType must conform to the ExpressibleByBooleanLiteral protocol.