title: Inserting data into a custom object
body: <p>I am still somewhat new to ObjC, so please forgive me if my terminology is off.</p>
  
  <p>I have a webservice which returns the following event data in an array:</p>
  
  <blockquote>
    <ul>
    <li>eventName</li>
    <li>eventAddress</li>
    <li>eventCity</li>
    </ul>
  </blockquote>
  
  <p>The webservice array varies in size from time to time, depending on how many events are happening on a certain day. </p>
  
  <p>My problem is that I need to pull this webservice data into a custom class(RandomEvent) automatically, but I'm not sure how to do it exactly.</p>
  
  <p>I can do it manually like this, but since the size of the webservice return array varies, it doesn't make sense to do it this way(see below):</p>
  
  <pre><code>- (NSArray *)todaysEvents {
      RandomEvent *event1 = [RandomEvent new];
      [event1 setName:eventName[0]];
      [event1 setAddress:eventAddress[0]];
      [event1 setCity:eventCity[0]];
  
      RandomEvent *event2 = [RandomEvent new];
      [event2 setName:eventName[1]];
      [event2 setAddress:eventAddress[1]];
      [event2 setCity:eventCity[1]];
  
      RandomEvent *event3 = [RandomEvent new];
      [event3 setName:eventName[2]];
      [event3 setAddress:eventAddress[2]];
      [event3 setCity:eventCity[2]];
  
      return @[event1, event2, event3];
  }
  </code></pre>
  
  <p>I know that I will have to iterate over the webservice array, but that's as far as I can get. What is the best way to assign the array values to my custom class? Any guidance will be greatly appreciated.</p>