Closed amadeu01 closed 2 years ago
Hey @amadeu01 sorry for the late response. Correct, that thing is used purely in tests by the ViewInspector, and this is a necessary workaround to make RootViewApparence
testable, since that modifier is using @State
(more info about it in the ViewInspector guide).
When and why
inspection = PassthroughSubject<((AnyView) -> Void), Never>()
is used onRootViewApparence
?https://github.com/nalexn/clean-architecture-swiftui/blob/7ef2ab4963725507b157c0ed553db57e68240717/CountriesSwiftUI/UI/RootViewModifier.swift#L24-L26
I was checking https://github.com/nalexn/clean-architecture-swiftui/commit/ce82dfe715bb596757581c2af37e46eb32ff8dc2 however I am not sure if that was added only due to tests.
Another thing that kept me wondering what is the utility of that property is that you have used ViewInspector on other parts of the project. Wouldn't be the case of using ViewInspector for testing the RootViewApparence as well ?