Skip to content

Instantly share code, notes, and snippets.

@OhhhThatVarun
Created March 16, 2021 13:39
Show Gist options
  • Save OhhhThatVarun/21dcf4c4eee90eabae18d84564e3852f to your computer and use it in GitHub Desktop.
Save OhhhThatVarun/21dcf4c4eee90eabae18d84564e3852f to your computer and use it in GitHub Desktop.
SwDin: Single and Factory demonstration.
// Using Single here because requirement is the same instance of the DatabaseClient on every @Inject.
let injectable = Single.init { _ in DatabaseClient()}
// Using Factory here becuase requirement is a new instance of MyViewModel on every @InjectViewModel.
let injectable = Factory.init {_ in MyViewModel()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment