A Swift package that enables catching Objective-C exceptions in Swift code, bridging a critical language interoperability gap.
ExceptionCatcher is a Swift package that allows developers to catch Objective-C exceptions in Swift code. It solves the problem where certain Cocoa APIs throw exceptions that Swift's native error handling cannot catch, bridging a critical interoperability gap between Swift and Objective-C.
Swift developers working with Cocoa frameworks on macOS or iOS who need to handle exceptions from Objective-C APIs like `NSKeyedUnarchiver`, `NSTask`, or key-value coding methods.
Developers choose ExceptionCatcher because it provides a simple, reliable way to handle Objective-C exceptions in Swift without complex workarounds, ensuring robust error handling in mixed-language environments.
Catch Objective-C exceptions in Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a mechanism to catch Objective-C exceptions in Swift, addressing a known limitation in Swift's Cocoa API compatibility, as highlighted in the README for APIs like NSKeyedUnarchiver.
Converts caught exceptions into Swift Error types, allowing seamless use with do-try-catch patterns, demonstrated in the usage example with key-value coding.
Includes detailed exception information like call stack symbols in debugPrint output, aiding in troubleshooting Objective-C exceptions within Swift code.
Offers a straightforward catch method that wraps a closure, making it easy to implement without complex configuration, as shown in the minimal usage snippet.
Only works on Apple platforms with Objective-C runtime, limiting its usefulness for cross-platform Swift development on Linux or Windows.
The README admits this functionality should be built into Swift, making it a temporary fix that could become obsolete if Swift adds native support.
Specifically designed for catching Objective-C exceptions, so it doesn't address broader Swift-Objective-C interoperability issues beyond exception handling.