The Debugger

Bugs are a fact of life. No matter what precautions you take, you will encounter bugs. The important thing is how long it takes to track down and fix bugs. That is where the debugger comes in.

The underlying debugger is LLDB, and although the console command line is important for some things, Xcode provides a user interface to three important features: viewing variables, breakpoints, and stepping through code.

When you hit a breakpoint or when a crash occurs, Xcode gives you access to a lot of information and tools. Figure 14-9 shows the CarValet app stopped at a breakpoint.

Image

Figure 14-9 Xcode debugging information

On the left is ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.