Watch for ObservableObject
in real time. (This is the Alpha version)
- Add package to you project.
let package = Package(
dependencies: [
.package(url: "https://github.com/YusukeHosonuma/ObservableObjectDebugger.git", branch: "main"),
],
targets: [
.target(name: "<your-target>", dependencies: [
"ObservableObjectDebugger",
]),
]
)
- Add
debugObserve
modifier to any View.
import ObservableObjectDebugger // ✅ Add import
struct ContentView: View {
@StateObject private var viewModel: ContentViewModel = .init()
var body: some View {
Text("Hello")
.debugObserve(viewModel) // ✅ You can specify any `ObservableObject`.
}
}
- Build and launch the Viewer app or reference to folder
/tmp/ObservableObjectDebugger
(with VSCode and others).
- iOS 14+ (Simulator only)
- macOS 12+ (Viewer app)
Yusuke Hosonuma / @tobi462