mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
9ead8781d4
Co-authored-by: Alex Martini <amartini@apple.com> Co-authored-by: Graham Lee <glee23@apple.com> Co-authored-by: Chris Adamson <cadamson@apple.com> Co-authored-by: Kirby Turner <kirby_turner@apple.com> Co-authored-by: Paris Pinkney <ppinkney@apple.com> Co-authored-by: Dave Spector <dspector@apple.com> Co-authored-by: Sofia Rodriguez Morales <sofia_rodriguez@apple.com> Co-authored-by: Ethan Kusters <ekusters@apple.com> Co-authored-by: Goli Mohammadi <g_mohammadi@apple.com> Co-authored-by: Adora Vaz <a_vaz@apple.com> Co-authored-by: David Rönnqvist <ronnqvist@apple.com> Co-authored-by: Nate Merseth Cook <natecook@apple.com> Co-authored-by: Susan Conant <susan_c@apple.com>
119 lines
3.2 KiB
Markdown
119 lines
3.2 KiB
Markdown
# ``Swift/Dictionary``
|
|
|
|
## Topics
|
|
|
|
### Creating a Dictionary
|
|
|
|
In addition to using a dictionary literal, you can also create a dictionary using
|
|
these initializers.
|
|
|
|
- ``Swift/Dictionary/init()``
|
|
- ``Swift/Dictionary/init(minimumCapacity:)``
|
|
- ``Swift/Dictionary/init(uniqueKeysWithValues:)``
|
|
- ``Swift/Dictionary/init(_:uniquingKeysWith:)``
|
|
- ``Swift/Dictionary/init(grouping:by:)``
|
|
- ``Swift/Dictionary/init(_:)``
|
|
|
|
### Inspecting a Dictionary
|
|
|
|
- ``Swift/Dictionary/isEmpty-11b2w``
|
|
- ``Swift/Dictionary/count-1s9fd``
|
|
- ``Swift/Dictionary/capacity``
|
|
|
|
### Accessing Keys and Values
|
|
|
|
- ``Swift/Dictionary/subscript(_:)-8rfql``
|
|
- ``Swift/Dictionary/subscript(_:default:)``
|
|
- ``Swift/Dictionary/index(forKey:)``
|
|
- ``Swift/Dictionary/subscript(_:)-4bhoo``
|
|
- ``Swift/Dictionary/keys-swift.property``
|
|
- ``Swift/Dictionary/values-swift.property``
|
|
- ``Swift/Dictionary/first``
|
|
- ``Swift/Dictionary/randomElement()``
|
|
- ``Swift/Dictionary/randomElement(using:)``
|
|
- ``Swift/Dictionary/init(dictionaryLiteral:)``
|
|
- ``Swift/Dictionary/init(_:)``
|
|
- ``Swift/Dictionary/indices``
|
|
|
|
### Adding Keys and Values
|
|
|
|
- ``Swift/Dictionary/updateValue(_:forKey:)``
|
|
- ``Swift/Dictionary/merge(_:uniquingKeysWith:)-m2ub``
|
|
- ``Swift/Dictionary/merge(_:uniquingKeysWith:)-7smbb``
|
|
- ``Swift/Dictionary/merging(_:uniquingKeysWith:)-3vtfs``
|
|
- ``Swift/Dictionary/merging(_:uniquingKeysWith:)-9bik6``
|
|
- ``Swift/Dictionary/reserveCapacity(_:)``
|
|
|
|
### Removing Keys and Values
|
|
|
|
- ``Swift/Dictionary/filter(_:)``
|
|
- ``Swift/Dictionary/removeValue(forKey:)``
|
|
- ``Swift/Dictionary/remove(at:)``
|
|
- ``Swift/Dictionary/removeAll(keepingCapacity:)``
|
|
|
|
### Comparing Dictionaries
|
|
|
|
- ``Swift/Dictionary/==(_:_:)``
|
|
- ``Swift/Dictionary/!=(_:_:)``
|
|
|
|
### Iterating over Keys and Values
|
|
|
|
- ``Swift/Dictionary/forEach(_:)``
|
|
- ``Swift/Dictionary/enumerated()``
|
|
- ``Swift/Dictionary/lazy``
|
|
- ``Swift/Dictionary/makeIterator()``
|
|
- ``Swift/Dictionary/underestimatedCount-4ggro``
|
|
|
|
### Finding Elements
|
|
|
|
- ``Swift/Dictionary/contains(where:)``
|
|
- ``Swift/Dictionary/allSatisfy(_:)``
|
|
- ``Swift/Dictionary/first(where:)``
|
|
- ``Swift/Dictionary/firstIndex(where:)``
|
|
- ``Swift/Dictionary/min(by:)``
|
|
- ``Swift/Dictionary/max(by:)``
|
|
- ``Swift/Dictionary/indices``
|
|
- ``Swift/Dictionary/Element``
|
|
|
|
### Transforming a Dictionary
|
|
|
|
- ``Swift/Dictionary/mapValues(_:)``
|
|
- ``Swift/Dictionary/reduce(_:_:)``
|
|
- ``Swift/Dictionary/reduce(into:_:)``
|
|
- ``Swift/Dictionary/compactMap(_:)``
|
|
- ``Swift/Dictionary/compactMapValues(_:)``
|
|
- ``Swift/Dictionary/flatMap(_:)-i3ly``
|
|
- ``Swift/Dictionary/flatMap(_:)-6chv9``
|
|
- ``Swift/Dictionary/sorted(by:)``
|
|
- ``Swift/Dictionary/shuffled()``
|
|
- ``Swift/Dictionary/shuffled(using:)``
|
|
|
|
### Performing Collection Operations
|
|
|
|
- <doc:order-dependent-operations-on-dictionary>
|
|
|
|
### Encoding and Decoding
|
|
|
|
- ``Swift/Dictionary/encode(to:)``
|
|
- ``Swift/Dictionary/init(from:)-6e6js``
|
|
|
|
### Describing a Dictionary
|
|
|
|
- ``Swift/Dictionary/description``
|
|
- ``Swift/Dictionary/debugDescription``
|
|
- ``Swift/Dictionary/customMirror``
|
|
- ``Swift/Dictionary/hash(into:)``
|
|
|
|
### Supporting Types
|
|
|
|
- ``Swift/Dictionary/Keys-swift.struct``
|
|
- ``Swift/Dictionary/Values-swift.struct``
|
|
- ``Swift/Dictionary/Index``
|
|
- ``Swift/Dictionary/Iterator``
|
|
- ``Swift/Dictionary/Element``
|
|
|
|
|
|
### Infrequently Used Functionality
|
|
|
|
- ``Swift/Dictionary/init(dictionaryLiteral:)``
|