The first element of the collection.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
Discussion
If the collection is empty, the value of this property is nil
.
The first element of the collection.
SDK
Framework
If the collection is empty, the value of this property is nil
.
subscript(Key) -> Value?
Accesses the value associated with the given key for reading and writing.
subscript(Key, default: () -> Value) -> Value
Accesses the value with the given key. If the dictionary doesn’t contain the given key, accesses the provided default value as if the key and default value existed in the dictionary.
func index(for Key: Key) -> Dictionary<Key, Value>.Index?
Returns the index for the given key.
subscript(Dictionary<Key, Value>.Index) -> Dictionary<Key, Value>.Element
Accesses the key-value pair at the specified position.
var keys: Dictionary<Key, Value>.Keys
A collection containing just the keys of the dictionary.
var values: Dictionary<Key, Value>.Values
A collection containing just the values of the dictionary.
func random Element() -> (key: Key, value: Value)?
Returns a random element of the collection.
func random Element<T>(using: inout T) -> (key: Key, value: Value)?
Returns a random element of the collection, using the given generator as a source for randomness.