Here’s a question for discussion that will bring shivers of shared pain to the Swift programmer, no doubt:
Moshe Berman writes, “If I’ve got a bunch of chained guard let statements, how can I diagnose which condition failed, short of breaking apart my guard let into multiple statements? Given this example:
How can I tell which of the 4 let statements was the one that failed and invoked the else block?”
How, indeed? TL;DR There isn’t a really good way. Bah.
However, besides the linked article there’s an active discussion at the Stack Overflow question, and we’d suggest checking on them to see if anything that suits you has shown up, and if not pick up some more Swifty tricks along the way. The one we like the best so far is this gist from AfricanSwift defing the =∅ (null check) debug operator:
If you have a better suggestion, that Stack Overflow question is waiting!