Skip to content

A library for building Null Objects in Objective-C. (Inspired in avdi's naught)

License

Notifications You must be signed in to change notification settings

endSly/NullObjects

Repository files navigation

NullObjects

NullObjects is a library for building Null Objects in Objective-C. It's inspired by Ruby's Naught.

Adding NullObjects to your project

CocoaPods

CocoaPods is the best way to include NullObjects in your project.

Include pod 'NullObjects', '~> 0.0.1' to your Podfile.

Usage

NONull is a replacement for NSNull but it acts more similarity to nil. It never raises an exception when method is call.

Simple Null Object

#import <NullObjects/NullObjects.h>

id null = [NONull null];

[null foo]; // == nil

Blackhole

#import <NullObjects/NullObjects.h>

id null = [NONull blackhole];

[null foo]; // == [NONull blackhole]

Replacing NSNull

Some system libraries uses NSNull for represent null object. NONull can replace NSNull object:

#import <NullObjects/NullObjects.h>

[NSNull actAsNullObject];
[NSNull actAsBlackhole];

About

A library for building Null Objects in Objective-C. (Inspired in avdi's naught)

Resources

License

Stars

Watchers

Forks

Packages

No packages published