Browse Questions
Answer: Breakpoints pause execution so you can inspect state. Xcode has several types beyond simple line breaks.
Types of breakpoints:
Line breakpoint — pause at a specific line (click gutter)
Conditional breakpoint — pause only when condition is true
Symbolic breakpoint — pause when any method with a name is called
Exception breakpoint — pause when any exception is thrown
watchpoint — pause when a variable's value changes
Tips:
// 1. Conditional breakpoint — right-click → Edit Breakpoint
// Condition: indexPath.row == 5 && indexPath.section == 0
// 2. Action breakpoint — log without stopping execution
// Add action: "po user.name" — logs to console, continues
// 3. Symbolic breakpoint for a framework method
// Symbol: -[UIViewController viewDidAppear:]
// Catches every viewDidAppear in the app
// 4. LLDB in console
po user // print description of 'user'
p user.name // print property
expr user.name = "Alice" // modify value while paused
bt // backtrace — see call stack