I'm inspecting Combine, a new framework by Apple. I created a playground, ran it in macOS Mojave 10.14.5 and Xcode 11.0 beta (11M336w).
Here is my code:
import Combine
struct Article: Identifiable {
var id: Int
var title: String
}
final class Data: BindableObject {
let didChange = PassthroughSubject<Data, Never>()
var showFavouriteOnly = false {
didSet {
didChange.send(self)
}
}
var articles: [Article] = [.init(id: 1, title: "WWDC 2018"),
.init(id: 2, title: "WWDC 2019")] {
didSet {
didChange.send(self)
}
}
}
But it fails with log:
error: Couldn't lookup symbols: Combine.PassthroughSubject.send(A) -> ()
What am I doing wrong?
If you created an iOS playground, then Combine
should work even if you’re running Xcode 11 or later on macOS 10.14. If you created a macOS playground, Combine
will only work if you are running Xcode 11 or later on macOS 10.15 (Catalina) or later.
If you created an iOS playground, then it’s entirely possible that you have found a bug in Combine (or in the Swift compiler). You can report it at Apple’s feedback site if you like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With