title: TableView not reloading after .childRemoved from external Firebase server
body: <p>I'm having trouble with loading the table view. The moment I call <code>self.messagesTable.reloadData()</code> my local tableView does not reload the data deleted from a external Firebase server.</p>
  
  <p>These two are my handlers for the observer:</p>
  
  <pre><code>fileprivate var _refHandle: FIRDatabaseHandle! 
  fileprivate var _refHandleDel: FIRDatabaseHandle!
  </code></pre>
  
  <p>Outlet</p>
  
  <pre><code>@IBOutlet weak var messagesTable: UITableView!
  </code></pre>
  
  <p>Code in FCViewController:</p>
  
  <pre><code>var ref: FIRDatabaseReference!
  var messages: [FIRDataSnapshot]! = []
  var messageClass = [Message]()
  var messageDictionary = [String: Message]()
  
  func configureDatabase() {
  
          // configure database to sync messages and connect it to the data base starting at "/"
          ref = FIRDatabase.database().reference()
  
          // create a listener on what happend on the database
          _refHandle = ref.child("messages").observe(.childAdded) { (snapshot: FIRDataSnapshot!) in
              self.messages.append(snapshot)
              // Animate and scroll the new message loaded
              self.messagesTable.insertRows(at: [IndexPath(row: self.messages.count - 1, section: 0)], with: .automatic)
              self.scrollToBottomMessage()
          }
  
          _refHandleDel = ref.child("messages").observe(.childRemoved, with: { (snapshot: FIRDataSnapshot!) in
  
              self.messageDictionary.removeValue(forKey: snapshot.key)
  
              // MY PROBLEM IS HERE: The table does not load properly and does not reloadData from the server after deleting the snapshot.key
              self.messagesTable.reloadData()
  
  
      }, withCancel: nil)
      }
  
  
  
  
  deinit {
          // set up what needs to be deinitialized when view is no longer being used
          // we remove the observer that is all the time checking for updates in the .observer handler
          ref.child("messages").removeObserver(withHandle: _refHandle)
          ref.child("messages").removeObserver(withHandle: _refHandleDel)
  
          // we also remove the listener for auth changes when the user registers
          FIRAuth.auth()?.removeStateDidChangeListener(_authHandle)
      }
  </code></pre>
  
  <p>Scroll Messages Function also inside the FCViewController:</p>
  
  <pre><code>func scrollToBottomMessage() {
      if messages.count == 0 { return }
      let bottomMessageIndex = IndexPath(row: messagesTable.numberOfRows(inSection: 0) - 1, section: 0)
      messagesTable.scrollToRow(at: bottomMessageIndex, at: .bottom, animated: true)
  </code></pre>
  
  <p>}</p>
  
  <p>Message Class Object in a separate .swift file courtesy of @Jay</p>
  
  <pre><code>class Message: NSObject {
  
  class MessageClass {
      var key = ""
      var name = ""
      var text = ""
      var timestamp = ""
  }
  
  var messagesArray = [MessageClass]()
  let ref = FIRDatabase.database().reference()
  
  func readInAllMessages() {
      let messagesRef = ref.child("messages")
      messagesRef.observeSingleEvent(of: .value, with: { snapshot in
          for child in snapshot.children {
              let snap = child as! FIRDataSnapshot
              let msg = self.snapToMsgClass(child: snap)
              self.messagesArray.append(msg)
          }
      })
  }
  
  func addRemoveObserver() {
      let messagesRef = ref.child("messages")
      messagesRef.observe(.childRemoved, with: { snapshot in
          let keyToRemove = snapshot.key
  
          if let i = self.messagesArray.index(where: { $0.key == keyToRemove }) {
              self.messagesArray.remove(at: i)
          }
      })
  }
  
  func snapToMsgClass(child: FIRDataSnapshot) -&gt; MessageClass {
      let dict = child.value as! [String:Any]
      let name = dict["name"] as! String
      let msg = MessageClass()
      msg.name = name
      msg.key = child.key
      return msg
  }
  
  
  }
  </code></pre>