In the Xcode 9 view debugger, I'd like to select a view in the 3-D exploded diagram of views, and then reveal that view in the hierarchy on the left. I know I can "focus" on that view by double-clicking it or selecting "Focus on UIView" from the contextual menu. I know I can also filter by some part of the type of view I want to find, but I actually just want to view I have selected in the context of the complete hierarchy in a single step. I haven't found a way of doing this-- am I missing something?
First, launch a project with some interesting UI. Project 13, for example, has enough in there to be interesting. Now run the program as normal, then in Xcode go to the Debug menu and choose View Debugging > Capture View Hierarchy. After a few seconds of thinking, Xcode will show you a screenshot of your app's UI.
UIView hierarchy is a tree with it's root in a window ( UIWindow is a subclass of UIView ). We can traverse this tree using subviews and superview properties. UIViewController hierarchy starts from the rootViewController of a window.
When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.
The Xcode debugger provides several methods to step through your code and inspect variables. You can precisely control execution of your code from a breakpoint, stepping into and out of called functions as necessary to determine where your bug occurs.
You can use the Xcode menu item "Navigate / Reveal in Debug Navigator" to reveal the selected item in the outline view.
Or the convenient keyboard shortcut ⌘ + Shift + D.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With