Reputation: 2341
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?
Upvotes: 7
Views: 2417
Reputation: 2968
The first version of Xcode 11 beta does not have Combine working, it has been stated in the release note.
You should download the second Xcode 11 beta (11M337n)
Upvotes: 1
Reputation: 385600
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.
Upvotes: 2