Clean-Swift / CleanStore

A sample iOS app built using the Clean Swift architecture. Clean Swift is Uncle Bob's Clean Architecture applied to iOS and Mac projects. CleanStore demonstrates Clean Swift by implementing the create order use case described by in Uncle Bob's talks.
https://clean-swift.com/clean-swift-ios-architecture/
MIT License
1.91k stars 315 forks source link

Should the Configurator be singleton? #3

Open onmyway133 opened 8 years ago

onmyway133 commented 8 years ago

Like in https://github.com/Clean-Swift/CleanStore/blob/master/CleanStore/Scenes/ListOrders/ListOrdersConfigurator.swift

You said that "There should be only one configurator for each scene, and the connection setup code should run once and only once" (http://clean-swift.com/clean-swift-ios-architecture/)

Why not let it be instance? Just create it (or DI) and let it do the job?

basememara commented 6 years ago

+1 for DI, but no singletons pls.. let's keep it clean ;)

basememara commented 6 years ago

I wonder if we can build a DI mechanism into Clean Swift like this: https://github.com/orakaro/Pure-Swift-Dependency-Injection