I have this check in SwiftUI
if tasks.first(where: { task in
return isDone(task)
}) != nil {
let task = tasks.first(where: { task in
return isDone(task)
}
)
I'm wondering if there's a way in SwiftUI 3 to use task from the check, instead of having to redefine it in the success block?
I've tried replacing the first line with if let task = tasks.first .... but it returns a Bool, which makes sense.
Not really sure what this is called so don't know what else to research.
Thank you!