-
Notifications
You must be signed in to change notification settings - Fork 16
/
AutoDependencyInjection.generated.swift
77 lines (63 loc) · 2.93 KB
/
AutoDependencyInjection.generated.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Generated using Sourcery 2.0.2 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
// swiftlint:disable all
import CioTracking
import Common
import Foundation
/**
######################################################
Documentation
######################################################
This automatically generated file you are viewing is a dependency injection graph for your app's source code.
You may be wondering a couple of questions.
1. How did this file get generated? Answer --> https://github.com/levibostian/Sourcery-DI#how
2. Why use this dependency injection graph instead of X other solution/tool? Answer --> https://github.com/levibostian/Sourcery-DI#why-use-this-project
3. How do I add dependencies to this graph file? Follow one of the instructions below:
* Add a non singleton class: https://github.com/levibostian/Sourcery-DI#add-a-non-singleton-class
* Add a generic class: https://github.com/levibostian/Sourcery-DI#add-a-generic-class
* Add a singleton class: https://github.com/levibostian/Sourcery-DI#add-a-singleton-class
* Add a class from a 3rd party library/SDK: https://github.com/levibostian/Sourcery-DI#add-a-class-from-a-3rd-party
* Add a `typealias` https://github.com/levibostian/Sourcery-DI#add-a-typealias
4. How do I get dependencies from the graph in my code?
```
// If you have a class like this:
class OffRoadWheels {}
class ViewController: UIViewController {
// Call the property getter to get your dependency from the graph:
let wheels = DIGraph.getInstance(siteId: "").offRoadWheels
// note the name of the property is name of the class with the first letter lowercase.
}
```
5. How do I use this graph in my test suite?
```
let mockOffRoadWheels = // make a mock of OffRoadWheels class
DIGraph().override(mockOffRoadWheels, OffRoadWheels.self)
```
Then, when your test function finishes, reset the graph:
```
DIGraph().reset()
```
*/
extension DIGraph {
// call in automated test suite to confirm that all dependnecies able to resolve and not cause runtime exceptions.
// internal scope so each module can provide their own version of the function with the same name.
@available(iOSApplicationExtension, unavailable) // some properties could be unavailable to app extensions so this function must also.
func testDependenciesAbleToResolve() -> Int {
var countDependenciesResolved = 0
_ = deepLinkUtil
countDependenciesResolved += 1
return countDependenciesResolved
}
// DeepLinkUtil
@available(iOSApplicationExtension, unavailable)
var deepLinkUtil: DeepLinkUtil {
if let overridenDep = overrides[String(describing: DeepLinkUtil.self)] {
return overridenDep as! DeepLinkUtil
}
return newDeepLinkUtil
}
@available(iOSApplicationExtension, unavailable)
private var newDeepLinkUtil: DeepLinkUtil {
DeepLinkUtilImpl(logger: logger, uiKitWrapper: uIKitWrapper)
}
}