When view contains it self inside of a ForEach then find(text:) does not find text and fails with .searchFailure. When i check manually the searched text is found (see testGoToText in sample)
Minimal sample to reproduce
View with recursion inside of ForEach:
struct TreeView: View {
struct Item: Identifiable {
var id: Int { name.hashValue }
var name: String
var childs: [Item] = []
}
var item: Item
var body: some View {
VStack {
Text(item.name)
ForEach(item.childs, id: \.name) {
TreeView(item: $0)
}
}
}
}
Description
When view contains it self inside of a
ForEach
thenfind(text:)
does not find text and fails with.searchFailure
. When i check manually the searched text is found (seetestGoToText
in sample)Minimal sample to reproduce
View with recursion inside of ForEach:
Test case with failing test
testFindText
Snapshot of testview: