Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subclassing BaseMessageCollectionViewCell #46

Closed
bcamur opened this issue Feb 25, 2016 · 6 comments
Closed

Subclassing BaseMessageCollectionViewCell #46

bcamur opened this issue Feb 25, 2016 · 6 comments

Comments

@bcamur
Copy link

bcamur commented Feb 25, 2016

Hi, I'm trying to subclass BaseMessageCollectionViewCell as you did with TextMessageCollectionViewCell and PhotoMessageCollectionViewCell, however even if I try to copy all of the code of TextMessageCollectionViewCell and rename it to something else I get several compiler errors such as: "Initializer does not override any method from its superclass".
Actually all I need to override is canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool function and add some methods for custom edit menu actions. I tried to do this in an extension of TextMessageCollectionViewCell but apparently Swift doesn't let me override canPerformAction in an extension. Do you have any suggestions or workarounds for this problem. Or any other way to add custom items to edit menu of chat bubbles. Thanks.

@diegosanchezr
Copy link
Contributor

Inheriting from BaseMessageCollectionViewCell is missing public access level for init(frame:) and createBubbleView() so they can't be inherited outside ChattoAdditions module as I mentioned in #26. Can you try that locally and make a PR if it works?

@bcamur
Copy link
Author

bcamur commented Feb 25, 2016

Do you mean changing those methods to public? And by working do you mean if I can subclass ChattoChatViewController outside of ChattoAdditions? If your answer to both of these questions are 'yes', I would be more than happy to attempt to contribute to Chatto.

@diegosanchezr
Copy link
Contributor

Yes, I mean changing those methods to public and verifying it solves your problem (that you can subclass the cells). ChatViewController has no problems being subclassed (it's done in ChattoApp)

@bcamur
Copy link
Author

bcamur commented Feb 26, 2016

Just finished the work after struggling with Xcode for hours :/ With the changes in #48 I can successfully subclass BaseMessageCollectionViewCell.

@diegosanchezr
Copy link
Contributor

@bcamur thank you!

@bcamur
Copy link
Author

bcamur commented Feb 26, 2016

You are welcome, and thank you; this was my first PR and contribution to an OSS project :) You can close the issue whenever you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants