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

Use custom cell in Objective-c #152

Closed
fadizant opened this issue Jul 14, 2018 · 6 comments
Closed

Use custom cell in Objective-c #152

fadizant opened this issue Jul 14, 2018 · 6 comments

Comments

@fadizant
Copy link

I can't inherit swift class to objective c class then there is no way to use custom cell from this awesome control, Any way to make it possible please ?

@WenchaoD
Copy link
Owner

Actually you can inherit swift class to objective c class.

@fadizant
Copy link
Author

fadizant commented Jul 17, 2018

I had search for that and so many people said that you can't !
https://stackoverflow.com/a/35244676

sorry for my bad english

@fikricanc
Copy link

I can't subclass FSPagerViewCell neither. It says

Cannot subclass a class that was declared with the 'objc_subclassing_restricted' attribute

Can you reproduce this? Since there is no subclass example in objc demo project, I can't be sure if I have set up something wrong.

@hyd00
Copy link

hyd00 commented Aug 4, 2019

I was lucky that I didn't have any code in my Obj-C Custom Cell Class, so I removed them, and directly set the Class of my Custom Cell XIB to FSPagerViewCell in StoryBoard. Worked for me!

@sruizpe
Copy link

sruizpe commented Feb 12, 2020

Same issue here:

#import <UIKit/UIKit.h>
@import FSPagerView;

@interface FSPageViewCell : FSPagerViewCell

-> Cannot subclass a class that was declared with the 'objc_subsclassing_restricted' attribute.

I have no chance to subclass the FSPagerViewCell in objective-C so I can add extra outlets to this default cell.

Any idea on this? I'm really stuck.

@sruizpe
Copy link

sruizpe commented Feb 12, 2020

Solved.

OK, it seems the only possible solution is subclass FSPagerViewCell.swift in a new swift cell class rather than an Objective-c class, which by definition does not allow by the compiler.

Once you have subclassed it on a new Swift class, you can import this new class into your Objective-c code.

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

5 participants