I think I found a bug in Combine.
Consider the following code:
import Combine
class Main {
@Published var doubleOptional: String??
var subscriptions: Set<AnyCancellable> = []
init() {
$doubleOptional
.sink { print("value from direct sink: \(String(describing: $0))") }
.store(in: &subscriptions)
$doubleOptional
.combineLatest(Just(0))
.sink { print("value after combine latest: \(String(describing: $0.0))") }
.store(in: &subscriptions)
}
}
let main: Main = .init()
Output is
value from direct sink: nil
value after combine latest: Optional(nil)
when I think it should give the same value (nil
).