Skip to content

Instantly share code, notes, and snippets.

Created May 22, 2022 16:21
What would you like to do?
Filter with KeyPath
struct Foo {
var bar: Int
var overThreshold: Bool {
bar > 5
let fooArray: [Foo] = ...
let filtered = fooArray.filter(\.overThreshold)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment