Stepping through code and inspecting variables to isolate bugs | Apple Developer Documentation
If the root cause of a bug isn’t immediately obvious when inspecting your source code, watching your variables change as you step through the code helps you isolate where the bug is occurring so you can investigate the possible cause for 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 monitor variables while stepping through code, or pause execution to inspect them more closely. Start your investigation at a breakpoint when your app is in a known good state before the bug occurs, at a point where you think the bug may be about to happen. When you run your app, the debugger pauses at the first breakpoint it encounters, and, by default, updates the display to show the Debug navigator, the source editor, the debug bar, the variable viewer, and the console. Customize what Xcode
To navigate the symbols, press Up Arrow, Down Arrow, Left Arrow or Right Arrow No items were found 1 item was found {number} items were found. Tab back to navigate through them. re looking for can't be found."},"color-scheme":{"select":"Select a color scheme preference","auto":"Auto","dark":"Dark","light":"Light"},"accessibility":{"strike":{"start":"start of stricken text","end":"end of stricken text"},"code":{"start":"start of code block","end":"end of code block"},"skip-navigation":"Skip Navigation","in-page-link":"in page link"},"select-language":"Select the language for this page","icons":
Explore this link on the map →related reading
- Setting breakpoints to pause your running app | Apple Developer Documentationdeveloper.apple.com
- Building and running an app | Apple Developer Documentationdeveloper.apple.com
- A Bunch of Programming Advice I'd Give To Myself 15 Years Ago | Marcus' Blogmbuffett.com
- Reading 13: Debuggingweb.mit.edu
- Reading 9: Debuggingweb.mit.edu
- The Debugger's Toolkit - by Addy Osmani - Elevateaddyo.substack.com
- CS106B Backtracking Warmupweb.stanford.edu
- GitHub - ChromeDevTools/chrome-devtools-mcp: Chrome DevTools for coding agents · GitHubgithub.com
- CSC 151 - Hypothesis-driven debuggingeikmeier.sites.grinnell.edu
- Protocollie Claude Code Vibe Coding setup · GitHubgist.github.com
- Documentationdocs.swift.org
- To understand anything, keep popping the hood.blog.larah.me