Mastering macOS Programming
上QQ阅读APP看书,第一时间看更新

Getting the most out of breakpoints

It's very likely you're using breakpoints already; any debugging you have done will have been very difficult without them. To add a breakpoint to your code, you can do one of the following:

  • Click the romantically named gutter to the left of the code editor
  • Create a breakpoint at the line the cursor is on with the shortcut command + \
  • The same command + \ will also delete an existing breakpoint

And while on the subject, you can disable (though not delete) all breakpoints with the shortcut command + Y. If you're new to Xcode, that may be new to you. So now you know.

A breakpoint does exactly what you expect it to do: it halts the code immediately at the line it is located at. But it doesn't stop there (well, I suppose it does... no pun intended).