When working on a Swift library for iOS, you would you sandbox the library so an error in this library will not be repercuted in the host application? (= uncaught error will not crash the app)
Here are some clue that don't cover everything perfectly:
- using
NSSetUncaughtExceptionHandler
: only catch Obj-c exception (NSException) - using background queue with try/catch and closure, such as here.
The disered behavior can compare to Android where you could have one Thread and have an Thread.UncaughtExceptionHandler
on it so everything going wrong here will be catched.
There may be no proper solution except try/catching everything because of the design of the language (see here).