Skip to content

Instantly share code, notes, and snippets.

@garsdle
Last active March 22, 2018 21:01
Show Gist options
  • Save garsdle/e5e6ce3f8a777a337dcb6dbdb67f7390 to your computer and use it in GitHub Desktop.
Save garsdle/e5e6ce3f8a777a337dcb6dbdb67f7390 to your computer and use it in GitHub Desktop.
Injection of a class into another
class Helper { /* I do helpful things */ }
class MainClass {
let helper: Helper
init(helper: Helper) {
self.helper = helper
}
}
let helper = Helper()
let mainClass = MainClass(helper: helper)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment