Bool

struct Bool
  • int

    SwifterSwift: Return 1 if true, or 0 if false.

    false.int -> 0
    true.int -> 1
    

    Declaration

    Swift

    public var int: Int { get }
  • SwifterSwift: Return true if true, or false if false.

    false.string -> "false"
    true.string -> "true"
    

    Declaration

    Swift

    public var string: String { get }
  • SwifterSwift: Returns a random boolean value.

    Bool.random -> true
    Bool.random -> false
    

    Declaration

    Swift

    public static var random: Bool { get }
  • SwifterSwift: Return inversed value of bool.

       false.toggled -> true
       true.toggled -> false
    

    Declaration

    Swift

    @available(*, deprecated: 4.3, message: "Use !self instead.")
    public var toggled: Bool { get }
  • SwifterSwift: Toggle value for bool.

       var bool = false
       bool.toggle()
       print(bool) -> true
    

    Declaration

    Swift

    @available(*, deprecated: 4.3, message: "Use !self instead.")
    @discardableResult
    public mutating func toggle() -> Bool

    Return Value

    inversed value of bool.