I have to implement a lot of different types of cells. For each cell, I’m passing the SBDBaseMessage to know in which position the respective cell will be presented.
I have a SBUChannelViewController subclass, in which I override cellForRow method like that:
Cell creation works perfectly, I’ve instantiated my SBUBaseMessageCell subclass and called the configure(message: _, position: _, hideDateView: _, receiptState: _) method. But here’s the glitch: my cells flipped. Crazy right?
its not actually glitch but you have to transform up side down to display properly on channel view. The reason is because tableview itself is already up side down (its pretty normal on chat view). I think we need to clearly state this on documentation. Thanks for the feedback tho!
The reason why tableview is up side down is because it is more convenient to insert latest message at the top rather than at the bottom of tableview. So when you scroll down (attempting to read previous message), we append newly fetched previous messages to the list so it naturally displays on the bottom of the tableview (though it seems on top of the view because its up side down). Thats one way to implement chat view. You can find more information on google (here one https://blog.kulman.sk/filling-uitableview-from-bottom-top/)