Created
March 16, 2021 13:39
-
-
Save OhhhThatVarun/21dcf4c4eee90eabae18d84564e3852f to your computer and use it in GitHub Desktop.
SwDin: Single and Factory demonstration.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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