subscript(_:as:default:)
Reads and writes the value associated with the given key converted to the specified type, falling back to the given default value.
Declaration
subscript<T>(key: String, as type: T.Type = T.self, default defaultValue: @autoclosure () -> T) -> T where T : BinaryFloatingPoint { 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
keyexists or if conversion totypefails.
Return Value
The value associated with key in the dictionary; otherwise, nil.