16

Is it possible to catch a NSInternalInconsistencyException in Swift ? If it is, how could that be done?

smat88dd
  • 2,258
  • 2
  • 25
  • 38

1 Answers1

4

It can be done for example with https://github.com/williamFalcon/SwiftTryCatch. First add it to your Podfile:

use_frameworks!
pod 'SwiftTryCatch'

Then in your code import SwiftTryCatch and then you can catch Objective-C exceptions like this

SwiftTryCatch.try({ 
    // try block
}, catch: { (error) in
    // catch block
}, finally: {
    // finally block
})
Leszek Szary
  • 9,763
  • 4
  • 55
  • 62