MVP or Model View Presenter, better than MVC.
Presenter : Protocol as a bridge to connect 2 classes (presenter and ViewController)
protocol RegistrationDelegate{
func showProgress()
func hideProgress()
func registrationDidSucceed()
func registrationDidFailed(message: String)
}
Use extentions to manage protocol implementations :
extension ViewController: RegistrationDelegate{
func showProgress(){
}
func hideProgress(){
}
func registrationDidSucceed(){
print("succeed")
}
func registrationDidFailed(message: String){
print(message)
}
}