I’m a little confused about the reason for including this:
-(void)setAssets:(NSArray *)a
{
_assets = [a mutableCopy];
}
-(NSArray *)assets
{
return [_assets copy];
}
We have already included the ‘copy’ attribute in this property so I thought the copy functionality would already be built into the getter and setter?
@property (nonatomic, copy) NSArray *assets;
If we want to create a copy of assets in the setter then why in the ‘addAsset’ method, do we simply add a pointer to the asset passed as an argument into the assets array and not a copy of this asset?
Greatly appreciated if someone could clear up this confusion with ‘copy’ and ‘strong’.