title: New class with arrays and a dictionary
body: <p>I'm new to Xcode, and I'm trying to create a class with arrays and a dictionary. I don't understand how to correctly initialize the object. What am I doing wrong?</p>
  
  <p><strong>"maindata.h"</strong></p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface maindata : NSDictionary
  {
      NSDictionary *maindict;
      NSArray      *arrayofallmethods;
      NSArray      *categories;
      NSArray      *methods;
  }
  
  @property(nonatomic,retain) NSDictionary *maindict;
  @property(nonatomic,retain) NSArray      *categories;
  @property(nonatomic,retain) NSArray      *methods;
  @property(nonatomic,retain) NSString     *pathtoplist;
  
  
  +(maindata *) shareddata;
  
  @end
  </code></pre>
  
  <p><strong>"maindata.m"</strong></p>
  
  <pre><code>#import "maindata.h"
  
  @implementation maindata
  
  @synthesize maindict;
  @synthesize methods;
  @synthesize categories;
  @synthesize pathtoplist;
  
  static maindata *shareddata_;
  
  -(id)init
  {
      if(self == [super init])
      {
          pathtoplist = [[NSBundle mainBundle] pathForResource:@"allData" ofType:@"plist"];
          shareddata_.maindict = [NSMutableDictionary dictionaryWithContentsOfFile:pathtoplist];
          shareddata_.methods = [maindict allValues];
      }
  
      return shareddata_;
  }
  
  +(maindata *) shareddata
  {
      if (!shareddata_)
      {
          shareddata_ = [[maindata alloc] init];
      }
  
      return shareddata_;
  }
  
  @end
  </code></pre>