When I receive a message I write the username and count of unread messages to CoreData. And with the help of this function:
func unreadMessagesCountBadge(cell: onlineUserCell, forCount count: Int)
I add to the cell my badge.
But the problem is, I do not know how to add this badge to exact user. When I get messages, I get this in logs:
data: {
count = 15;
username = "my_user@domain.com";
}
So, how can I with it add my badge to exact cell? On my cell I have just user's name and surname, not username.
When I try:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> onlineUserCell {
let cell:onlineUserCell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! onlineUserCell
unreadMessagesCountBadge(cell, forCount: badgeValue)
}
but it adds my badges to all users, not to exact user. Anyideas how can I fix it?