NullObjects is a library for building Null Objects in Objective-C. It's inspired by Ruby's Naught.
CocoaPods is the best way to include NullObjects in your project.
Include pod 'NullObjects', '~> 0.0.1'
to your Podfile
.
NONull
is a replacement for NSNull
but it acts more similarity to nil. It never raises an exception when method is call.
#import <NullObjects/NullObjects.h>
id null = [NONull null];
[null foo]; // == nil
#import <NullObjects/NullObjects.h>
id null = [NONull blackhole];
[null foo]; // == [NONull blackhole]
Some system libraries uses NSNull
for represent null object. NONull
can replace NSNull
object:
#import <NullObjects/NullObjects.h>
[NSNull actAsNullObject];
[NSNull actAsBlackhole];