Closed wnagrodzki closed 5 years ago
@moskacz @pwetrifork What do you think?
Maybe it's dependency injection that should be mentioned here instead of a protocol. I would say using protocols to enable unit testing should be formulated as a separate guideline, it's not that you only want it for singletons.
@pwetrifork I agree, using protocol is not the only way to decouple from singleton instance (one could provide a singleton subclass to act as a mock). Text has been updated.
@wnagrodzki agree
Do not access singleton instance directly via static method -
Singleton.sharedInstance()
. Decouple from it with dependency injection.