Conversation
Open up MessagesCollectionViewFlowLayout cell sizing API
Add .custom(Any) case to MessageData
Document MediQuo application as a user of MessageKit
Move delegate methods to allow override
Enhancement/transit info detection
Add cellTopLabel and rename topLabel to messageTopLabel
|
Finally!!! |
|
@SD10 , I prepare to remove |
|
@zhongwuzw I remember we changed to this setup because we want to make sure everything is working correctly on CocoaPods |
|
|
||
| open func numberOfSections(in collectionView: UICollectionView) -> Int { | ||
| guard let collectionView = collectionView as? MessagesCollectionView else { | ||
| fatalError(MessageKitError.notMessagesCollectionView) |
There was a problem hiding this comment.
TBO, we have much these fatalError, maybe we can have a better friendly way to do this (maybe assert or just use some default values)? other than just stop execution in Debug or Release.
There was a problem hiding this comment.
I agree, but I haven't found any good solution TBH. I had some default values before and removed them all because it just doesn't make sense 😕 We would be writing code that never gets executed. You have to set all 3 protocols MessagesDataSource, MessagesDisplayDelegate, and MessagesLayoutDelegate or nothing works
There was a problem hiding this comment.
Yeah, I think the fatalErrors here are valid. With good documentation in the superclasses this should not be an issue. And if it is; its a valid reason to crash there as there is no way to recover.
Changing these to asserts could be an option to prevent crashes in release builds, but I am not sure if that’s the best approach. How does it work with APIs like UITableView and UICollectionView?
There was a problem hiding this comment.
Thanks for the feedback @BasThomas!
How does it work with APIs like UITableView and UICollectionView?
This is not standard UITableView or UICollectionView behavior. Instead of extending the UIKit protocols, we conform to them internally and then call our own MessageKit protocols inside of them. This is to decouple the MessagesDataSource from UICollectionViewDataSource, so the project can be used with things like IGListKit. We're forced to provide a valid implementation or it is a fatalError 😕
There was a problem hiding this comment.
Seems like a good usage of fatalError then. :)
|
|
||
| // MARK: - Top cell Label | ||
|
|
||
| public func cellTopLabelSize(for message: MessageType, at indexPath: IndexPath) -> CGSize { |
There was a problem hiding this comment.
@SD10 Can we integrate these methods to one? it's a little bit redundancy ,cellTopLabel/messageTopLabel/messageBottomLabel's size and alignment are almost the same.
There was a problem hiding this comment.
I don't think so 😕 I didn't even want these to be public but people have requested them to be accessible when they subclass. The only way to combine it into 1 method is to pass it an enum I think? I really don't like those kinds of API
|
Don't know if I want to merge this as is or ship the beta from |
|
🤔 I prefer to choose just merge to |
|
ah @zhongwuzw. I meant I can push a new release to CocoaPods from the |
* Fixed separator line height * Update CHANGELOG.md
|
Probs gonna merge this if CI passes and open an issue for adding better docs or testing as starter tasks |
|
I wish I had the free time to benchmark this vs the current |
|
Yeah, that just happened |
No description provided.