Skip to content

Instantly share code, notes, and snippets.

@DejanEnspyra
Created September 20, 2017 17:44
Show Gist options
  • Save DejanEnspyra/4ceedd860bf118bacc4f3897d447fa67 to your computer and use it in GitHub Desktop.
Save DejanEnspyra/4ceedd860bf118bacc4f3897d447fa67 to your computer and use it in GitHub Desktop.
Clean Swift Architecture - Configurator component
import UIKit
// MARK: - Connect View, Interactor, and Presenter
extension ViewController: TestPresenterOutput
{
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
{
router.passDataToNextScene(segue: segue)
}
}
extension TestInteractor: ViewControllerOutput
{
}
extension TestPresenter: TestInteractorOutput
{
}
class TestConfigurator {
// MARK: - Object lifecycle
static let sharedInstance = TestConfigurator()
private init() {}
// MARK: - Configuration
func configure(viewController: ViewController)
{
let router = TestRouter()
router.viewController = viewController
let presenter = TestPresenter()
presenter.output = viewController
let interactor = TestInteractor()
interactor.output = presenter
viewController.output = interactor
viewController.router = router
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment