title: Saving Objects to Firebase
body: <p>First time working on a Firebase app. I understand that it doest not allow you to save actual Objective C object.I understand that everything is saved in a JSON tree which can be NSStrings, NSNumbers, NSArrays, NSDictionaries.  You actually have to drill down to each property to get the actual value. Ex. </p>
  
  <p>Say you have myObject => Firebase doesn't like it. You have to set the value by getting the property. Ex. myObject.name (which would be a string). This is very annoying if your objects have a a lot properties. </p>
  
  <p>I understand that you can implement NSCoding to make it a bit more elegant. I have never done this before. I have the following Object for a user. </p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface User : NSObject &lt;NSCoding&gt;
  
  
  @property (nonatomic, copy) NSString *username;
  @property (nonatomic, copy) NSString *name;
  @property (nonatomic, copy) NSString *currentCity;
  
  @end
  </code></pre>
  
  <hr>
  
  <pre><code>#import "User.h"
  
  @implementation User
      @dynamic username;
      @dynamic name;
      @dynamic currentCity;
  
  -(void)encodeWithCoder:(NSCoder *)encoder{
  
      [encoder encodeObject:self.username forKey:@"username"];
      [encoder encodeObject:self.name forKey:@"name"];
      [encoder encodeObject:self.currentCity forKey:@"currentCity"];
  
  
  }
  
  -(id)initWithCoder:(NSCoder *)decoder{
  
      if (self = [super init]) {
          self.username = [decoder decodeObjectForKey:@"username"];
          self.name = [decoder decodeObjectForKey:@"name"];
          self.currentCity = [decoder decodeObjectForKey:@"currentCity"];
  
      }
  
      return self;
  }
  </code></pre>
  
  <p>so when saving to the User Object which is stored in Firebase, do we just encode the object when we are saving to firebase? </p>
  
  <p>I'm a bit confused about how to save it or even retrieve it. Parse is a lot more straight forward, but for this app I need to user firebase. </p>
  
  <p>Any help or examples of how you guys handled this would be greatly appreciated. </p>
  
  <p>Thanks you!</p>