Conversation
|
Feels dangerous to add a type to a project where the exact intention is it'll immediately crash? Am I missing something? |
|
@Sherlouk It's to allow people to make custom cells, basically if |
|
Is that documented somewhere? |
|
|
|
Nah that just tells you that you fucked up! Not how to fix it! Sent with GitHawk |
|
This would be super useful so I gave the changes a quick go locally, but hit a snag 😅: |
|
Can you show a example of implementation of .custom(Any) |
|
@stephtelolahy We'll definitely have some example documentation but I can't get to that right now. You can do a lot with |
|
@SD10 I tried to override |
|
@SD10 , Oops , we can only put non-override method in extentions. |
|
Wow that is surprising because I'm allowed to mark them as |
|
Suggestion: This way we could add our custom behavior by overriding By marking as @objc you would solve the non-override problem I guess. Same thing could work for wdyt? |
|
@yokomizor That's an interesting suggestion. Why not just override and call super though? |
|
@SD10 calling super will check MessageType again, and throw the fatalError. If you remove the Maybe it would be even better if you delegate this to wdyt? |
|
@yokomizor I was expecting users to |
|
@yokomizor Also keep in mind, you really should not be using |
|
@SD10 Oh! true. We don't need messageContainerSizeForDefault. |
|
How do you expect users will set a custom collectionViewLayout? I suppose users could pass the custom one through init: To do so, they need to set messagesCollectionView again on MessagesViewController since the default one is created on init phase: So, the default instance will be created anyway, even if users would not use it. I understand this is wip. Anyway, it would be nice to know which path you are planning to follow. btw, wdyt about the delegate suggestion? Users are used to override default behavior using Cheers! |
|
@SD10 btw, back to the override topic. Even calling super later, MessageType will be checked twice. First to check if it is |
|
@yokomizor , If you want to use custom layout, I think override |
|
@yokomizor You would return before super is called in the case of Sent with GitHawk |
|
@SD10 for |
|
@zhongwuzw cool. So delegates won't be an option? Less disruptive maybe 👼 |
override func messageContainerSize(for message: MessageType, at indexPath: IndexPath) -> CGSize {
switch message.data {
case .custom(_):
// handle sizing
default:
super.messageContainerSize(for: message, at: indexPath)
}
}No double checks |
|
My point is that we could check it just once in order to address it to the right handler. Makes sense? Calling |
|
It shouldn’t make a difference in production, especially since a switch will exit at the first match. It is a good point to bring up though 👍👍 Sent with GitHawk |
This resolves #479 and provides an override point for creating custom cells
TODO: