I have a chat screen that uses Firebase. I am using the following code:
ref2.observeEventType(.ChildAdded, withBlock: { snapshot in
let msg = snapshot.value.objectForKey("message")!
self.addMsg(String(msg))
})
func addMsg(m:String) {
txtChat.text = txtChat.text + "\r\n" + m
}
It works properly but when you first connect to the database, it processes all of the previous messages. I would like to fix it so a user will only see the messages that were added while he was in the room.