vhesener / Closures

Swifty closures for UIKit and Foundation
MIT License
1.74k stars 153 forks source link

UIViewController #26

Open SentoCrespo opened 6 years ago

SentoCrespo commented 6 years ago

It would be reaaaaally nice to have life cycle methods: viewDidLoad will/did appear/disappear etc.

Thanks for this nice kit!

vhesener commented 6 years ago

Interesting concept. I've thought about it in other lifecycle mechanisms, but not view controllers.

This will be different because UIViewController lifecycle methods are subclassed, rather than delegated. It's an interesting problem though.

Can you set the stage with a use case for how you would interact with these methods? I'm assuming from outside the controller, correct? Is there a particular navigation architecture (i.e. VIPER) that would benefit from this?

SentoCrespo commented 6 years ago

Hello Sir!

You're very right, indeed. Model View Presenter for instance or any other architecture that separates the view from who controls it like VIPER, or MVVM or whatever. The presenter would be able to control everything from outside it, although I know it might be coupled to a specific type but I was only curious about all this concept.

Right now I'm using RxSwift with some extension for UIViewController that allows me to do such thing: https://github.com/devxoul/RxViewController

vhesener commented 6 years ago

Let me think for a little about how to do this. Stay tuned.