[Pitch] KeyPath based map, flatMap, filter

I think the more swifty solution to that, is to pair existing mutating func toggle with a toggled property

extension Bool {
    var toggled: Bool { !self }
}
let projects = ["a", "b", "", "c"]
print(projects.filter(\.isEmpty.toggled)) // ["a", "b", "c"]

Please, let’s not do this again.

Where from do you know the specific date?

Also writing new ! operator function might do the trick.

func !<T>(_ predicate: (T) -> Bool) -> ((T) -> Bool)) {
    return { input in !predicate(input) }
}
1 Like

I don't "know", it's just a strong inference from the release of the .4 OSes tomorrow. If they want devs to ship apps taking advantage of the new features they'll need to release the new Xcode, or at least a GM.

1 Like

Ah, right. For some reason I thought iPadOS was already out, but that was the dev GM.

An operator, or some sort of negation extension for KeyPath<Root, Bool>s could be appropriate.

1 Like