Looking at the Apple example application for MultipeerGroupChat (specifically MainViewController.m):
The example contains the below code assigning properties:
@property (retain, nonatomic) NSMutableArray *transcripts;
@property (retain, nonatomic) NSMutableDictionary *imageNameIndex;
and then initializing them in viewDidLoad:
- (void)viewDidLoad
{
[super viewDidLoad];
// Init transcripts array to use as table view data source
_transcripts = [NSMutableArray new];
_imageNameIndex = [NSMutableDictionary new];
---SNIP---
Is there a reason they are assigning directly to the ivars _transcripts and _imageNameIndex? I thought proper convention dictates that you always use the properties to access the variables unless you are in an init method...indeed, a little further in the viewDidLoad method the author does use properties to assign other variables:
self.displayName = [defaults objectForKey:kNSDefaultDisplayName];
self.serviceType = [defaults objectForKey:kNSDefaultServiceType];
I know Apple example code has, in the past, sometimes strayed from good coding practices, so I'm wondering if this is just sloppy coding or if there is a valid reason to access those two ivars directly in a non-initialization method.
There is no definitive way for how properties have to be accessed. Seeing as this is just a demo project, the engineer who wrote this probably knew the scope of the project allowed for some shortcuts.
What's been done here isn't wrong, it just isn't recommended.