Skip to content

Instantly share code, notes, and snippets.

@gazdagsandor
gazdagsandor / DI-easy
Last active September 24, 2018 14:30
DI container supereasy
import UIKit
// Non thread safe DI container simple implementation
class Container {
var services: [String: Factory] = [:]
func register<Service: AnyObject>(service: Service.Type, factory: @escaping () -> Service) {
let creator = FactoryImpl<Service>(with: factory, isSingleton: false)

Keybase proof

I hereby claim:

  • I am gazdagsandor on github.
  • I am valhalladixie (https://keybase.io/valhalladixie) on keybase.
  • I have a public key ASDXGxprUaQr8915WOGs9tt2uSzCSId4NTuEGF_pT57IVAo

To claim this, I am signing this object: