Created
March 6, 2010 22:26
-
-
Save alexrozanski/323983 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSArray (PXArrayAdditions) | |
- (id)initWithObject:(id)object; | |
- (id)firstObject; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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