I'm following along with the WWDC 2019 'Combine in Practice' video and I get the following error
Cannot find 'CombineLatest' in scope
I did it in a playground made in Xcode 12
import SwiftUI
import Combine
class Stuff {
@Published var password: String = ""
@Published var passwordAgain: String = ""
var validatedPassword: AnyPublisher<String?, Never> {
// wtf? "Cannot find 'CombineLatest' in scope"
return CombineLatest($password, $passwordAgain) { password, passwordAgain in
guard password == passwordAgain, password.count > 8 else { return nil }
return password
}
.map { $0 == "password1" ? nil : $0 }
.eraseToAnyPublisher()
}
}
Has the API changed since 2019? Because it seems that
CombineLatest($password, $passwordAgain) -> $password.combineLatest($passwordAgain)
Is this true? Can anyone find any formal documentation on if it's true and why?