I'm trying to follow the book instructions for XCode + Cargo, and I'm getting the error below.
[...]/ios-rust-analyzer/IosRustAnalyzer/IosRustAnalyzer/IosRustAnalyzerApp.swift:20:7 Type 'RustAppWrapper' does not conform to protocol 'ObservableObject'
Here's the code that seemed to fix it:
import Combine
import SwiftUI
@main
struct IosRustAnalyzerApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(RustAppWrapper(rust: RustApp()))
}
}
}
class RustAppWrapper: ObservableObject {
@Published var rust: RustApp
init(rust: RustApp) {
self.rust = rust
}
}