類型別名
Boolean
BooleanLiteralType
otherwise-unconstrained 布爾文字的默認類型。
聲明
typealias BooleanLiteralType = Bool
詳述
當您使用布爾文字 true
或 false
之一創建常量或變量時,生成的類型由 BooleanLiteralType
別名確定。例如:
let isBool = true
print("isBool is a '\(type(of: isBool))'")
// Prints "isBool is a 'Bool'"
BooleanLiteralType
別名的類型必須符合ExpressibleByBooleanLiteral
協議。
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相關用法
- Swift Bool !(_:)用法及代碼示例
- Swift Bool用法及代碼示例
- Swift Bool random()用法及代碼示例
- Swift Bool ||(_:_:)用法及代碼示例
- Swift Bool init(booleanLiteral:)用法及代碼示例
- Swift Bool random(using:)用法及代碼示例
- Swift Bool &&(_:_:)用法及代碼示例
- Swift Bool toggle()用法及代碼示例
- Swift BinaryInteger quotientAndRemainder(dividingBy:)用法及代碼示例
- Swift BinaryInteger trailingZeroBitCount用法及代碼示例
- Swift BinaryInteger init(clamping:)用法及代碼示例
- Swift BinaryInteger <<=(_:_:)用法及代碼示例
- Swift BinaryInteger !=(_:_:)用法及代碼示例
- Swift BinaryInteger /(_:_:)用法及代碼示例
- Swift BinaryInteger init(truncatingIfNeeded:)用法及代碼示例
- Swift BinaryInteger ==(_:_:)用法及代碼示例
- Swift BinaryFloatingPoint binade用法及代碼示例
- Swift BidirectionalCollection subscript(_:)用法及代碼示例
- Swift BidirectionalCollection last(where:)用法及代碼示例
- Swift BidirectionalCollection lastIndex(where:)用法及代碼示例
- Swift BinaryInteger init(_:)用法及代碼示例
- Swift BinaryInteger %=(_:_:)用法及代碼示例
- Swift BinaryFloatingPoint random(in:using:)用法及代碼示例
- Swift BinaryInteger &=(_:_:)用法及代碼示例
- Swift BidirectionalCollection lastIndex(of:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 BooleanLiteralType。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。