Adjust for `ObservableObject` being in `Combine`, and `willChange` instead of `didChange`
This might require a little rework.
Combine also has the @Published, though SwiftUI still has the @ObservedObject.
I don't think @ObservedObject in this project is working. Is it?
If it should. I had no luck with getting it to compile while having @ObservedObject wrapper somewhere. :/
It should work, here is the sample I was testing with: https://github.com/SwiftWebUI/Tinker2/blob/master/Sources/Tinker2/Views/Tests/BindingTestView.swift
What is this for? #if canImport(Combine) import Combine #elseif canImport(OpenCombine) import OpenCombine #endif
Should I add OpenCombine to the project? I think it is not working due to the fact the Two types ObservableObject are colliding with each others.
I've copy example from here example
That's what I am getting.
Without SwiftWebUI.Obse.... I have error such as:
'ObservableObject' is ambiguous for type lookup in this context
All this is completely unrelated to this issue. OpenCombine is required on Linux, on macOS you can use the regular Combine (but you need Catalina).
What I meant is that I still can't get it to work. Due to errors presented above.
Oh, sorry. Actually it may not work indeed 🤔 That's what the issue is about 😄 I suppose SwiftWebUI is still assuming didChange, but ObservedObject already switched to willChange. Things probably go wrong ...
This might require a little rework.
I'm not sure how much, maybe it isn't actually that bad. Just replacing didChange w/ willChange might work, because WebUI is still working in a transaction. The "will" will still mark the view as dirty and should trigger the diffing.
Resolved compiling issue. By placing ObservableObject in separate file with one import of SwiftWebUI. Now I can work it out what's happening inside. See if and what is required to be corrected