You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -24,7 +24,7 @@ The Injected property wrapper will automatically instantiate objects using the c
24
24
### Lazy Injection
25
25
26
26
Resolver also has a LazyInjected property wrapper. Unlike using Injected, lazily injected services are not resolved until the code attempts to access the wrapped service.
@@ -37,7 +37,7 @@ Note that LazyInjected is a mutating property wrapper. As such it can only be us
37
37
### Weak Lazy Injection
38
38
39
39
Resolver also has a WeakLazyInjected property wrapper. Like LazyInjected, services are not resolved until the code attempts to access the wrapped service.
@@ -72,7 +72,7 @@ If you go this route just make sure you specify the name *before* accessing the
72
72
### Optional injection
73
73
74
74
An annotation is available that supports optional resolving. If the service is not registered, then the value will be nil, otherwise it will be not nil:
75
-
```
75
+
```swift
76
76
classInjectedViewController: UIViewController {
77
77
@OptionalInjectedvar service: XYZService?
78
78
funcload() {
@@ -84,7 +84,7 @@ class InjectedViewController: UIViewController {
84
84
### Injection With Protocols
85
85
86
86
Injecting a protocol works with all of the injection property wrappers.
87
-
```
87
+
```swift
88
88
protocolLoader {
89
89
funcload()
90
90
}
@@ -102,19 +102,19 @@ Registration of the class providing the protocol instance is performed exactly t
102
102
103
103
You can specify and resolve custom containers using Injected. Just define your custom container...
104
104
105
-
```
105
+
```swift
106
106
extensionResolver {
107
107
staticvar custom =Resolver()
108
108
}
109
109
```
110
110
And specify it as part of the Injected property wrapper initializer.
Copy file name to clipboardExpand all lines: Documentation/Optionals.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ var abc: ABCServicing? = Resolver.resolve(ABCService.self)
58
58
## Optional annotation
59
59
60
60
An annotation is available that supports optional resolving. If the service is not registered, then the value will be nil, otherwise it will be not nil:
0 commit comments