Skip to content

Instantly share code, notes, and snippets.

extension Array {
func map<T>(_ keyPath: KeyPath<Element, T>) -> [T] {
return map { $0[keyPath: keyPath] }
}
}
struct Foo {
let bar: String
let baz: Int
}

Keybase proof

I hereby claim:

  • I am mmatoszko on github.
  • I am matoszko (https://keybase.io/matoszko) on keybase.
  • I have a public key ASAwpIs87y2QGBEzXwSVPVoQj47hxGWBNIKS4sV2yz0qFAo

To claim this, I am signing this object: