xcode,  objc,  swift,  auto-layout

Debugging view constraints with Xcode 7

A small button named 'Debug view hierarchy', displays current view hierarchy in 3D.

Debugging view constraints with Xcode 7

Until a tiny barely noticeable button was added to the debug area of Xcode, it used to take a number of breakpoints and print statements to debug view constraints.

Not anymore! A small button named “Debug view hierarchy,” displays current view hierarchy in 3D. All we have to do is to start our app in debug mode and click on the button when a view we want to debug is being displayed.

We can rotate the view by click-dragging the mouse and at the by selecting one of the views and clicking on it at the top we can view all its constraints!

Subscribe to The infinite monkey theorem

Get the latest posts delivered right to your inbox