Created
March 16, 2021 13:17
-
-
Save OhhhThatVarun/af16422e0668923c8ac5c66b52cad619 to your computer and use it in GitHub Desktop.
SwDin: Simple constructor Injection example.
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
import UIKit | |
class FirstViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// When we want to goto the SecondViewController. | |
let repository = SomeRepository() | |
let service = SomeService() | |
let viewModel = ViewModel(repository: repository, service: service) | |
let secondViewController = SecondViewController(viewModel: viewModel) | |
self.present(viewController, animated:true, completion:nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment