Is it possible to catch an NSInternalInconsistencyException in Swift?

Is it possible to catch an NSInternalInconsistencyException in Swift? If so, how can this be done?

+8
exception swift
source share
1 answer

This can be done, for example, using https://github.com/williamFalcon/SwiftTryCatch . First add it to your subfile:

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 }) 
+1
source share

All Articles