0Pricing
Swift Academy · Lesson

Iterating and Transforming Dictionaries

Using mapValues, filter, merge and grouping data with dictionaries.

Welcome

Dictionaries are full `Sequence` types. They support `for-in`, `map`, `filter`, `reduce`, and more — giving you a functional toolkit over keyed data.

for-in Iteration

```swift let prices = ["apple":1.5,"banana":0.8] for (fruit, price) in prices { print("\(fruit): $\(price)") } ``` Order is not guaranteed — sort `prices.sorted { $0.key < $1.key }` for determinism.

All lessons in this course

  1. Dictionary CRUD and Subscript Access
  2. Iterating and Transforming Dictionaries
  3. Set Operations: Union, Intersection, Difference
  4. Choosing Between Array, Dictionary and Set
← Back to Swift Academy