Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftKeyPath expressionsSingle-choice MCQ

In Swift, a key-path-as-function reference lets you pass `\Type.member` where a `(Type) -> Value` closure is expected. What does this evaluate to?

struct User { let name: String } let users = [User(name: "bo"), User(name: "alice")] let names = users.map(\.name) print(names)