Sample Objective-C code demonstrating NSError is the standard error handling mechanism in Objective-C, but using it defensively requires more than just passing a pointer. Learn patterns that prevent crashes and make debugging easier..
This project accompanies the article: Defensive Coding with NSError in Objective-C
- Xcode 26.2+
- iOS 26.0+
- Clone this repository
- Run
xcodegen generate(requires XcodeGen) - Open
DefensiveCodingNserrorObjc.xcodeproj - Build and run
- main.m: Source file
- AppDelegate.h: Source file
- AppDelegate.m: Source file
- MyAppError.h: Source file
- MyAppError.m: Source file
- DataManager.h: Source file
- DataManager.m: Source file
- ErrorHandler.h: Source file
- ErrorHandler.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.