# resultBuilder debugging pain

**URL:** <https://forums.swift.org/t/resultbuilder-debugging-pain/76275>\
**Category:** Using Swift\
**Tags:** result-builder\
**Created:** [November 28, 2024, 6:42pm UTC](https://forums.swift.org/t/resultbuilder-debugging-pain/76275 "2024-11-28T18:42:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hacksaw](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hacksaw/32/32775_2.png) [@Hacksaw](https://forums.swift.org/u/Hacksaw)\
**Post date:** [November 28, 2024, 6:42pm UTC](https://forums.swift.org/t/resultbuilder-debugging-pain/76275/1 "2024-11-28T18:42:48Z")

</div>

In using resultBuilders, primarily ViewBuilder, my biggest pain point is that internal problems are obscured by type inference error messages. Instead of being told where things broke down, I just get told it can't figure out the whole block.

This must be pretty pervasive, is there an efficient way to debug this?

I'm trying to make structural changes to a medium sized code base, and this means statements can suddenly be wrong that were right before. I just need to compiler to say, "yo, this here doesn't make sense" with useful specificity. Then I can go fix it.

---

<div class="post-metadata">

**Author:** ![BrentM](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/brentm/32/15134_2.png) [@BrentM](https://forums.swift.org/u/BrentM)\
**Post date:** [November 29, 2024, 7:45am UTC](https://forums.swift.org/t/resultbuilder-debugging-pain/76275/2 "2024-11-29T07:45:57Z")

</div>

the only way I've managed to debug these things is to comment out one item at a time in the result builder until the compiler can find what's wrong.

Definitely a major headache and something I wish the compiler could do for me.

---

<div class="post-metadata">

**Author:** ![flexlixrup](https://avatars.discourse-cdn.com/v4/letter/f/50afbb/32.png) [@flexlixrup](https://forums.swift.org/u/flexlixrup)\
**Post date:** [November 29, 2024, 9:05am UTC](https://forums.swift.org/t/resultbuilder-debugging-pain/76275/3 "2024-11-29T09:05:30Z")

</div>

I normally comment out the whole view body besides the top level element and then go step for step until it fails.  
Then I know which part is failing and comment out everything besides the minimal setup to get this part working.  
Then I get the error message. But I started to keep my view bodies really small and build everything up with `var xxx: some View`.

It is a major painpoint with SwiftUI and I wish there were some easier solution.
