Skip to content

Commit

Permalink
View Models cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
FitzAfful committed May 21, 2020
1 parent f0f636a commit a80e1c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class ServiceLocatorController: UIViewController {

let serviceLocator = DIServiceLocator.shared

guard let model: HomeViewModel = serviceLocator.resolve() else { return }
guard let model: HomeViewModel = serviceLocator.resolve() else {
print("Couldnt resolve model")

return }
self.viewModel = model

showLoader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SwinjectViewModel: HomeViewModelProtocol {

func fetchEmployees(completion: @escaping ([Employee]?, String?) -> Void) {
self.apiManager!.getEmployees { (result: DataResponse<EmployeesResponse, AFError>) in
print(result)
switch result.result {
case .success(let response):
if response.status == "success" {
Expand Down
2 changes: 1 addition & 1 deletion MockingProject/SupportingFiles/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
serviceLocator.register(APIManager() as APIManager)

guard let manager: APIManager = serviceLocator.resolve() else { return true }
serviceLocator.register(SwinjectViewModel(manager: manager))
serviceLocator.register(HomeViewModel(manager: manager))

return true
}
Expand Down

0 comments on commit a80e1c1

Please sign in to comment.