I spent about an hour trying to figure out why I was seeing logging, but no breakpoints being hit (in Xcode Version 10.0 (10A255)).
It seems that any code inside of a defer
block will have its breakpoints skipped.
Apple emailed me today, telling me that this is a duplicate of another radar:
Hello Eric,
Engineering has determined that your bug report (45048050) is a duplicate of 42858960 and will be closed.
- Clone this project
- Set breakpoints in
ViewController.swift
at lines17
and20
- Run the project
You'll notice that the breakpoint at line 20 fires, but the breakpoint at line 17 never fires.
Here's a workaround for this issue
Despite the breakpoint at line 17 not being hit a breakpoint inside of a function that's called from the defer
block is hit!
I've filed a Radar ticket for this issue, and added it to Open Radar #5048329775874048