Skip to content

Latest commit

 

History

History
73 lines (51 loc) · 1.33 KB

BoolExtensions.md

File metadata and controls

73 lines (51 loc) · 1.33 KB

Bool Extensions

Table of Contents

Name Type iOS tvOS watchOS macOS
int Read-Only Property 8+ 9+ 3+ 10.10+
string Read-Only Property 8+ 9+ 3+ 10.10+
toggled Read-Only Property 8+ 9+ 3+ 10.10+
toggle() Mutating Method 8+ 9+ 3+ 10.10+

--

int

Return 1 if true, or 0 if false.

  • type: Read-Only Property.
  • return type: Int
  • availability: iOS 8+ tvOS 9+ watchOS 3+ macOS 10.10+.

Example

true.int -> 1

--

string

Return "true" if true, or "false" if false.

  • type: Read-Only Property.
  • return type: String
  • availability: iOS 8+ tvOS 9+ watchOS 3+ macOS 10.10+.

Example

false.string -> "false"

--

toggled

Return inversed value of bool.

  • type: Read-Only Property.
  • return type: Bool
  • availability: iOS 8+ tvOS 9+ watchOS 3+ macOS 10.10+.

Example

false.toggled -> true

--

toggle()

Toggle value for bool.

  • type: Mutating Method.
  • return type: Bool
  • returns: inversed value of bool.
  • availability: iOS 8+ tvOS 9+ watchOS 3+ macOS 10.10+.

Example

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