Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
NSArray first element convenience
@interface NSArray (FSQFoundation)
- (id) firstObject; ///< @returns the first object if there is one, or nil.
@implementation NSArray (FSQFoundation)
- (id) firstObject {
if (self.count < 1) {
return nil;
return [self objectAtIndex:0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.