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 YYImage #158

Open
GiuseppePiscopo opened this issue Jul 16, 2021 · 0 comments
Open

Subclassing YYImage #158

GiuseppePiscopo opened this issue Jul 16, 2021 · 0 comments

Comments

@GiuseppePiscopo
Copy link

GiuseppePiscopo commented Jul 16, 2021

Hello all,
hope there's still someone reading this. In a number of issues the answerer suggests to solve problem by subclassing YYImage, eg. #1 , #36 , #146 .

Say that MyImage is the subclass name. The point is that, as soon as one tries to invoke MyImage(named: "whatever"), you get into typical errors of missing initializers in subclass.

Q1: Why does every suggestion completely misses to mention that? Maybe there's something wrong we're doing and I'm missing something evident.

Q2: We'd like to avoid duplicating code from YYImage class factory methods like:

+ (YYImage *)imageNamed:(NSString *)name

or from initializers:

- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale

but then there seems to be no way to invoke those from the subclass initializer, at least not from Swift.

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

1 participant