How to debug Auto Layout in UIKit?

Is there a way to tag views so debugging an auto layout crash becomes easier?
Answered by junkpile in 612806022
I’m not sure about views, but constraints do have an “identifier” property that you can set in code or IB (using the attributes inspector) to make analyzing the logs easier. Lots of tips on debugging auto layout here: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/AutolayoutPG/TypesofErrors.html#//apple_ref/doc/uid/TP40010853-CH17-SW1
If you get a constraints error at runtime you can try pasteing it into a site like wtfautolayout.com . It can provide a useful visualization of the constraints.

I believe if you name your view elements in the xib/storyboard editor’s sidebar those names will show up in the constraints, but I’m less certain about it without loading a project. It’s a good practice nonetheless!

Accepted Answer
I’m not sure about views, but constraints do have an “identifier” property that you can set in code or IB (using the attributes inspector) to make analyzing the logs easier. Lots of tips on debugging auto layout here: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/AutolayoutPG/TypesofErrors.html#//apple_ref/doc/uid/TP40010853-CH17-SW1
When I need to debug, I add a ID (as junk pile proposed) on any contraint of the view, from #01 up to #150 if needed.
That makes debugging much easier.
I also set ID for constraints created in code.
How to debug Auto Layout in UIKit?
 
 
Q