Bool
public extension Bool
                This extension for the Bool type adds a convenient method, toInt(), allowing you to convert a boolean value to its integer representation. The function returns 1 for true and 0 for false. This extension is helpful in situations where you need to represent boolean values as integers, such as when working with APIs or databases that expect integer representations for boolean flags.
- 
                  
                  
Extends the Bool type to convert a boolean value to its integer representation.
Example:
let isTrue = true let intValue = isTrue.toInt() print(intValue) // Output: 1Declaration
Swift
func toInt() -> IntReturn Value
An integer representing the boolean value, 1 for
trueand 0 forfalse. - 
                  
                  
Extends the Bool type to convert the boolean value to the string “true” oder “false”
Example:
let isTrue = true let stringValue = isTrue.toString() print(stringValue) // Output: "1"Declaration
Swift
func toString() -> StringReturn Value
The string
trueorfalse. 
            View on GitHub