sberrevoets / SDCAlertView

The little alert that could
MIT License
1.86k stars 297 forks source link

Open components to inheritance outside SDCAlertView module #311

Open lechuckcaptain opened 4 years ago

lechuckcaptain commented 4 years ago

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).

sberrevoets commented 4 years ago

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.

lechuckcaptain commented 4 years ago

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?

sberrevoets commented 4 years ago

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.

lechuckcaptain commented 4 years ago

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