title: Display all data from child node on a tableViewCell
body: <p>I'm having trouble displaying all of the followers of user on a table view cell with their profile picture and full name (similar to instagram). </p>
  
  <p>A snippet of my firebase JSON structure is:</p>
  
  <pre><code> "followers" : {
      "FoFQDAGGX9hntBiBdXYCBHd8yas2" : {
        "CjeP35ceAQZJuUPhm7U1eF3Yq4F3" : true,
        "FjS4wUpXAUa5aWwXkjvujHxE4He2" : true,
        "Gmg1ojNoBiedFPRNSL4sBZz2gSx2" : true,
        "PqMkClaPM3W8k7ZSgzAHb3yne5D3" : true,
        "buS4recuDpdg60ckFqwjoU344TC2" : true
      },
   "users" : {
      "CjeP35ceAQZJuUPhm7U1eF3Yq4F3" : {
        "email" : "bbbb@gmail.com",
        "fullname" : "Bbbb",
        "profileImageUrl" : "https://firebasestorage.googleapis.com/v0/b/pinion-4896b.appspot.com/o/profile_image%2FCjeP35ceAQZJuUPhm7U1eF3Yq4F3?alt=media&amp;token=0449c633-b397-4452-b2df-41f3a5390084",
        "work" : "Nottingham",
      },
  </code></pre>
  
  <p>Code in the table view cell (FollowersTableViewCell):</p>
  
  <pre><code>@IBOutlet weak var followersProfileImage: UIImageView!
  @IBOutlet weak var followersNameLabel: UILabel!
  
  var user: UserModel? {
      didSet {
          updateView()
      }
  }
  func updateView() {
      followersNameLabel.text = user?.fullname
      if let photoUrlString = user?.profileImageUrl {
          let photoUrl = URL(string: photoUrlString)
          followersProfileImage.sd_setImage(with: photoUrl, placeholderImage: UIImage(named: "placeholderImg"))
      }
  }
  </code></pre>
  
  <p>EDIT:
  Code in view controller (FollowersViewController)</p>
  
  <pre><code>@IBOutlet weak var tableView: UITableView!
  
  var users: [UserModel] = []
  
  func loadusers() {
      let ref = Database.database().reference()
      guard let currentUser = Auth.auth().currentUser?.uid else { return }
  
      var followersNames = [String]()
      var profileImage = [String]()
  
      let followersRef = ref.child("followers").child(currentUser) //retreives all nodes in the following node
      followersRef.observe(DataEventType.value, with: { snapshot in
          print(snapshot.children.allObjects)
          for child in snapshot.children { //build the array of keys
              let snap = child as! DataSnapshot
              let key = snap.key
  
              let userRef = ref.child("users").child(key) //get the user name and profile image from the users node
              userRef.observeSingleEvent(of: .value, with: { snapshot in
                  let followersName = snapshot.childSnapshot(forPath: "fullname").value as! String
                  let followersProfileImageUrl = snapshot.childSnapshot(forPath: "profileImageUrl").value as! String
                  print(followersName)
                  print(followersProfileImageUrl)
  
                  followersNames.append(followersName)
                  profileImage.append(followersProfileImageUrl)
                  self.tableView.reloadData()
              })
          }
      })
  }
  extension FollowersViewController: UITableViewDataSource {
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return users.count
  }
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "FollowersTableViewCell", for: indexPath) as! FollowersTableViewCell
      let user = users[indexPath.row]
      cell.user = user
      return cell
    }
  }
  </code></pre>
  
  <p>Now the code runs and the profile picture and fullname of the followers are printed on the console but doesn't show anything on the table view of the app - thanks in advance :)</p>
  
  <p>Update: 
  User model definition</p>
  
  <pre><code>class UserModel {
      var email: String?
      var work: String?
      var profileImageUrl: String?
      var fullname: String?
      var id: String?
  }
  extension UserModel {
      static func transformUser(dict: [String: Any], key: String) -&gt; UserModel {
          let user = UserModel()
          user.email = dict["email"] as? String
          user.work = dict["work"] as? String
          user.profileImageUrl = dict["profileImageUrl"] as? String
          user.fullname = dict["fullname"] as? String
          user.id = key
          return user
      }
  }
  </code></pre>