SDCAlertView icon indicating copy to clipboard operation
SDCAlertView copied to clipboard

Open components to inheritance outside SDCAlertView module

Open lechuckcaptain opened this issue 4 years ago • 4 comments

It could be really useful if some classes implemented into the library would be open to inheritance (e.g. AlertController, AlertAction, ...). At the moment is not possible to extend any of those classes (first one is declared final, the latter is not open).

lechuckcaptain avatar May 14 '20 10:05 lechuckcaptain

Could you explain why that would be useful? It's a non-reversible decision so I want to make sure it's done for the right reasons.

sberrevoets avatar May 14 '20 15:05 sberrevoets

I see your point. Let me explain more in detail my idea: having the possibility to extend AlertController (same concept on smaller scale for AlertAction) in order to prepare some ready to use complex customized variants.

Yes, I know that at least for the setup it would be possible to just write some static utility function (not the cleanest solution) or some wrapper class, but wouldn't be nice to have some specialized Alert that handle all the business logic (e.g. included custom views, text fields, ..) inside it instead of keeping them in the UIViewController that presents the alert?

lechuckcaptain avatar May 14 '20 16:05 lechuckcaptain

I get what you mean. I'll see if it's possible to make the classes themselves open without allowing for the public UIViewController methods to be overridden. Then the risk of interfering with some inherent behavior of the library is pretty low while you can still do what you want.

sberrevoets avatar May 14 '20 18:05 sberrevoets

Thanks, let me know if you need help or some more detailed use cases

lechuckcaptain avatar May 15 '20 07:05 lechuckcaptain