Never use respondsToSelector: anymore!
Objective-C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
PerformIfResponds.xcodeproj
Demo_APIVersion.m
Demo_Delegate.m
Info.plist
NSObject+PerformIfResponds.h
NSObject+PerformIfResponds.m
README.md
Tests.m

README.md

A performIfResponds proxy for NSObject. Never use -respondsToSelector again.

For example, this:

if([self.delegate respondsToSelector:@selector(fooForBar:]) {
	foo = [self.delegate fooForBar:self]:
}

becomes this:

foo = [[self.delegate performOrReturn:nil] fooForBar:self]:

See bou.io/PerformIfResponds for more details.