Skip to content

Instantly share code, notes, and snippets.

@phuongddx
Created May 27, 2020 07:38
Show Gist options
  • Save phuongddx/2985dbcd819e749ae4932d43f167de22 to your computer and use it in GitHub Desktop.
Save phuongddx/2985dbcd819e749ae4932d43f167de22 to your computer and use it in GitHub Desktop.
// View
class aViewController: UIViewController, aViewProtocl {
var presenter: aPresenterProtocol?
}
protocol aViewProtocol: class {
var presenter: aPresenterProtocl? { get set }
}
// Presenter
protocol aPresenterProtocol: class {
var view: aViewProtocol? { get set }
var wireFrame: aWireFrameProtocol? { get set }
var interactor: aInteractorInputProtocol? { get set }
// func do some things
}
class aPresenter: aPresenterProtocol {
weak var view: aViewProtocol?
var wireFrame: aWireFrameProtocol?
var interactor: aInteractorInputProtocol?\
// some func
}
extension aPresenter: aInteractorOutputProtocol {
// receive output from interactor output ,
// implement some func
}
// Inteactor
protocol aInteractorInputProtocol: class {
var presenter: aInteractorOutputProtocol? { get set } // variable receive output from remote or local
}
protocol aInteractorOutputProtocol: class {
// recevei output from remote or local
}
class aInteractor: aInteractorInputProtocol {
var presenter: aInteractorOutputProtocol?
}
extension aInteractor: aRemoteDataManagerOutputProtocol {
// implement remote output from remote or local
// some func
}
// Data( remote )
protocol aRemoteDataManagerInputProtocol: class {
// receive request from interactor
}
protocol aRemoteDataManagerInputProtocol: class {
// output này sẽ được lấy từ server or local, trả về lại cho interactor(output)
}
class aRemoteDataManager: aRemoteDataManagerInputProtocol {
// impletment func
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment