forked from kudoleh/iOS-Clean-Architecture-MVVM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppDIContainer.swift
executable file
·34 lines (28 loc) · 1.3 KB
/
AppDIContainer.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// DIContainer.swift
// ExampleMVVM
//
// Created by Oleh Kudinov on 01.10.18.
//
import Foundation
final class AppDIContainer {
lazy var appConfigurations = AppConfigurations()
// MARK: - Network
lazy var apiDataTransferService: DataTransferService = {
let config = ApiDataNetworkConfig(baseURL: URL(string: appConfigurations.apiBaseURL)!,
queryParameters: ["api_key": appConfigurations.apiKey])
let apiDataNetwork = DefaultNetworkService(config: config)
return DefaultDataTransferService(with: apiDataNetwork)
}()
lazy var imageDataTransferService: DataTransferService = {
let config = ApiDataNetworkConfig(baseURL: URL(string: appConfigurations.imagesBaseURL)!)
let imagesDataNetwork = DefaultNetworkService(config: config)
return DefaultDataTransferService(with: imagesDataNetwork)
}()
// DIContainers of scenes
func makeMoviesSceneDIContainer() -> MoviesSceneDIContainer {
let dependencies = MoviesSceneDIContainer.Dependencies(apiDataTransferService: apiDataTransferService,
imageDataTransferService: imageDataTransferService)
return MoviesSceneDIContainer(dependencies: dependencies)
}
}