title: Firebase converting snapshot value to objects
body: <p>So I have a <code>postDict</code> as <code>[String: AnyObject]</code> and I have a model class <code>Post</code>. </p>
  
  <p>Is there a quick way to convert <code>postDict</code> to an array of <code>Post</code> objects so that when dequeuing the cell, it will be:</p>
  
  <p><code>cell.textLabel.text = posts[indexPath.item].author</code></p>
  
  <pre><code>import UIKit
  import Firebase
  
  class ViewController: UIViewController {
  
  var posts = [Post]()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      let ref = FIRDatabase.database().reference().child("posts").queryLimitedToFirst(5)
  
      ref.observeEventType(FIRDataEventType.ChildAdded, withBlock: { (snapshot) in
          let postDict = snapshot.value as! [String : AnyObject]
  
          print(postDict)          
  
          //convert postDict to array of Post objects
      })
    }
  }
  
  class Post: NSObject {
      var author: String = ""
      var body: String = ""
      var imageURL: String = ""
      var uid: String = ""
  }
  </code></pre>
  
  <p>This is the output when printing out postDict:</p>
  
  <p><a href="https://i.stack.imgur.com/olR2Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/olR2Q.png" alt="enter image description here"></a></p>