cukr
March 23, 2020, 1:28pm
41
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"]
xwu
(Xiaodi Wu)
March 23, 2020, 1:30pm
42
cukr:
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 }
}
Please, let’s not do this again.
Where from do you know the specific date?
alikvovk
(Alik)
March 23, 2020, 1:36pm
44
Also writing new !
operator function might do the trick.
func !<T>(_ predicate: (T) -> Bool) -> ((T) -> Bool)) {
return { input in !predicate(input) }
}
1 Like
Jon_Shier
(Jon Shier)
March 23, 2020, 2:24pm
45
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.
Jon_Shier
(Jon Shier)
March 23, 2020, 2:27pm
47
An operator, or some sort of negation extension for KeyPath<Root, Bool>
s could be appropriate.
1 Like