Contents

subscript(_:as:default:)

Reads and writes the value associated with the given key as a Boolean value, falling back to the given default value.

Declaration

subscript(key: String, as type: Bool.Type = Bool.self, default defaultValue: @autoclosure () -> Bool) -> Bool { get }

Parameters

  • key:

    The key the look up in the dictionary.

  • type:

    The expected type for the returned value.

  • defaultValue:

    The value to use if no value for key exists or if conversion to type fails.

Return Value

The value associated with key in the dictionary; otherwise, nil.

See Also

Accessing keys and values