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
- Dictionary CRUD and Subscript Access
- Iterating and Transforming Dictionaries
- Set Operations: Union, Intersection, Difference
- Choosing Between Array, Dictionary and Set