Problem Statement
What is a key-path in Swift and how can it assist higher-order functional code?
Explanation
Key-paths in Swift (like `\.name`) are typed references to properties you can use in higher-order functions for concise code. For example: `people.map(\.name)` extracts the name property from each person. This pattern improves readability and reduces boilerplate.
Practice Sets
This question appears in the following practice sets: