Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarasis/324588 to your computer and use it in GitHub Desktop.
Save tarasis/324588 to your computer and use it in GitHub Desktop.
@interface NSArray (PXArrayAdditions)
- (id)initWithObject:(id)object;
- (id)firstObject;
@end
@implementation NSArray (PXArrayAdditions)
- (id)initWithObject:(id)object
{
return [self initWithObjects:object,nil];
}
//Follows -lastObject in that returns nil if no objects present
- (id)firstObject
{
if([self count]>0) {
return [self objectAtIndex:0];
}
else {
return nil;
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment