Sample Objective-C code demonstrating Objective-C supports exception handling with @try/@catch, but the community settled on NSError pointers instead. Here's why..
This project accompanies the article: Why Objective-C Has try-catch But Nobody Uses It
- Xcode 26.2+
- iOS 26.0+
- Clone this repository
- Run
xcodegen generate(requires XcodeGen) - Open
TryCatchNserrorObjc.xcodeproj - Build and run
- main.m: Source file
- AppDelegate.h: Source file
- AppDelegate.m: Source file
- FileProcessor.h: Source file
- FileProcessor.m: Source file
- InputValidator.h: Source file
- InputValidator.m: Source file
- DemoResult.h: Source file
- DemoResult.m: Source file
- ViewController.h: Source file
- ViewController.m: Source file
This project is written in Objective-C to demonstrate traditional iOS development patterns.
Read the full article at BleepingSwift for detailed explanations and additional examples.
MIT License - see LICENSE for details.