-
-
Save gblazex/d7699dd7bc5bb9255c71 to your computer and use it in GitHub Desktop.
This file contains 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
// | |
// NSArray+IndexHelper.h | |
// C_POS | |
// | |
// Created by Tomohisa Takaoka on 6/14/12. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSArray (IndexHelper) | |
-(id) safeObjectAtIndex:(NSUInteger)index; | |
@end |
This file contains 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
// | |
// NSArray+IndexHelper.m | |
// C_POS | |
// | |
// Created by Tomohisa Takaoka on 6/14/12. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import "NSArray+IndexHelper.h" | |
@implementation NSArray (IndexHelper) | |
-(id) safeObjectAtIndex:(NSUInteger)index { | |
if (index>=self.count) { | |
return nil; | |
} | |
return [self objectAtIndex:index]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment