Contents

subscript(_:)

Reads and writes the value associated with the given key as a string.

Declaration

subscript(key: String) -> String? { get set }

Parameters

  • key:

    The key the look up in the dictionary.

Return Value

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

Discussion

When setting a String value, the string’s bytes are always copied. The underlying C string is assumed to be encoded as UTF-8.

See Also

Accessing keys and values