Skip to content

Instantly share code, notes, and snippets.

@stephsharp
Last active December 21, 2015 10:09
Show Gist options
  • Save stephsharp/6289785 to your computer and use it in GitHub Desktop.
Save stephsharp/6289785 to your computer and use it in GitHub Desktop.
Insert an object into a property of type NSArray by creating a mutable copy.
@property (nonatomic, retain) NSArray * pins;
-(void)insertPin:(PinViewController *)pin
{
NSMutableArray * mutablePinsArray = [self.pins mutableCopy];
[mutablePinsArray addObject:pin];
self.pins = mutablePinsArray;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment