An example function:
@ViewBuilder func returnView() -> some View {
if thisIsTrue == true {
SomeView()
} else {
AnotherView()
}
}
I've tried testing like this:
let testView = sut.returnView()
XCTAssert(testView is SomeView)
Which passes when there is only one possible type of view, but then fails as soon as there is a choice.
Any suggestions as to how I can unit test the output of this function?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…