-2

I want to create a global crash handler so that i can show message to users. Crashes like 1. when value is nil(Force unwrap) 2. Unexpected datatype.

Jaykant
  • 349
  • 4
  • 11
  • 1
    These kinds of crashes are hard crashes. They will get your application into a state that is not recoverable. That means you won't be able to show anything to your users. – Sulthan Jun 10 '19 at 14:01
  • 1
    Both of those issues are the result of bad coding practices and not understanding the basics of Swift. You're supposed to improve your coding, not search for hacks. – mag_zbc Jun 10 '19 at 14:03
  • Related: [Uncaught Error/Exception Handling in Swift](https://stackoverflow.com/q/38737880/1187415). – Martin R Jun 10 '19 at 14:05
  • 2
    Of course by not doing forced unwrap or forced casting those crashes can be avoided and proper error handling can be used instead – Joakim Danielson Jun 10 '19 at 14:08

1 Answers1

0

No. A crash, by definition, means the program cannot continue executing.

Connor Neville
  • 7,291
  • 4
  • 28
  • 44