Swift version: 5.0
Exception breakpoints are a powerful debugging tool that remarkably few people know about, so please read the following carefully and put it into practice!
A regular breakpoint is on a line you specify, and causes the debugger to pause execution at that point so you can evaluate your program's state. An exception breakpoint tells the debugger to pause whenever a problem is encountered anywhere in your program, so you can evaluate your program's state before it crashes.
Exception breakpoints are trivial to set up: go to the Breakpoint Navigation (Cmd+7), then click the + button in the bottom left and choose Add Exception Breakpoint. You can leave it there if you want to, but it's preferable to make one further change to reduce unnecessary messages: right-click on your new breakpoint, choose Edit Breakpoint, then change the Exception value from "All" to "Objective-C".
SPONSOR Tired of wasting time debugging your Swift app? Instabug’s SDK is here to help you minimize your debugging time by providing you with complete device details, network logs, and reproduction steps with every bug report. All data is attached automatically. It only takes a line of code to setup. Get started for free.
Available from iOS 7.0 – see Hacking with Swift tutorial 18
Did this solution work for you? Please pass it on!
Other people are reading…
About the Swift Knowledge Base
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.