In Objective-C, the NSSetUncaughtExceptionHandler
can register some functionality to do some last minute logging about the exception.
This doesn't catch something crashing from Swift.
Is it possible to do something like this at a global level in Swift? E.g. do some logging if a crash happens in Swift code, like forced unwrapping a nil optional.
Specifically, I'm doing a utility to log network traffic in the app, and I would like to flush my in-memory data to disk if a crash happens.