Contents

bool(forKey:)

Returns the Boolean value associated with the specified key.

Declaration

func bool(forKey defaultName: String) -> Bool

Parameters

  • defaultName:

    The key to retrieve from the defaults database.

Return Value

The Boolean value associated with defaultName, or false if the key isn’t present in the defaults database.

Discussion

This method automatically coerces certain values to their equivalent Boolean meanings. For example, it coerces the numbers 1 and 1.0, and the strings “true”, “YES”, and “1” to the value true.

See Also

Getting the value of a key