Skip to content

Adaption of Clean Swift with Dependency Injection with Templates

License

Notifications You must be signed in to change notification settings

skorebrits/Clean-Swift-Injectable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clean-Swift-Injectable

Adaption of Clean Swift with Dependency Injection with Templates

This code is based on https://clean-swift.com by https://github.com/rayvinly

By making the Interactor & Presenter injectable the code becomes better reusable, and needs less setup.

if let cleanInjectableViewController = segue.destination as? CleanInjectDisplayDelegate,
    segue.identifier == "presentCleanInject" {
    cleanInjectableViewController.interactor = CleanInjectInteractor(
        presenter: CleanInjectPresenter(display: cleanInjectableViewController)
    )
}

vs

private func cleanSetup() {
    let viewController = self
    let interactor = CleanInteractor()
    let presenter = CleanPresenter()
    let router = CleanRouter()
    viewController.interactor = interactor
    viewController.router = router
    interactor.presenter = presenter
    presenter.viewController = viewController
    router.viewController = viewController
    router.dataStore = interactor
}

The project has a working example of Clean Swift and the same ViewController implemented as Injectable.

Templates are included for Scene & Tests

About

Adaption of Clean Swift with Dependency Injection with Templates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages