I'm using Xcode 13.4.1 and targeting iOS 15.0. I have aSwiftUI app that crashes as soon as you click a button that changes a variable from true to false:
Button("Close Side by Side Mode") {
mainScreenRecs.isViewingSideBySide = false
}
This is the only place where the variable is changed; everything else is just SwiftUI reading the variable to determine whether to show views or not, like this:
var body: some View {
VStack(spacing: 0) {
HStack {
if mainScreenRecs.isViewingSideBySide {
Text(catalogModel.title)
}
When I look at the debug stack, I can see that the previous modification says LayoutComputer.EngineDelegate.childGeometries(at:origin:), which makes me wonder if it's related to SwiftUI:
I see this in the debug output, which has the additional note about AttributeGraph: cycle detected through attribute, another possible SwiftUI problem:
I tried wrapping this code in DispatchQuery.main.async, like this:
Button("Close Side by Side Mode") {
DispatchQueue.main.async {
mainScreenRecs.isViewingSideBySide = false
}
}
but it didn't help. Is it possible this is a SwiftUI bug? I hate to think that because it leaves me stuck without a solution, but I can't figure out what else I could check or try.
4
0
1.9k