There are two situations in my code where I'd like a custom function that has the same essential functionality as fatalError()
, but named differently. These functions would be called todo()
and unimplemented()
. Now, I currently have utility functions by these names implemented as below, but they do not behave in the same way as fatalError()
:
public func todo(file: StaticString = #file, line: UInt = #line) -> Never {
fatalError("todo", file: file, line: line)
}
public func unimplemented(file: StaticString = #file, line: UInt = #line) -> Never {
fatalError("unimplemented", file: file, line: line)
}
The problem is that when I'm running my program under the Xcode debugger, and one of these functions is called, the debugger stops on the call to fatalError()
, and not on my call to, say, todo()
. While the file and line information printed to the console correctly reflect the call point of todo()
the debugger itself requires I go up a stack frame to see the invocation. During intense debugging sessions this starts to feel fatiguing, and I begin to want to be able to just make my own "un-callable" functions like fatalError()
, but so far I've yet to find a way to to this.
I've tried various approaches like asking the compiler to inline my custom calls, and making them aliases of fatalError()
, but these end up being impractical.
I just want to write todo()
and have the debugger show execution stopping there, and not anywhere else.
Thoughts?