@@ -66,29 +66,29 @@ public func withDependencies<R>(
66
66
operation: ( ) async throws -> R
67
67
) async rethrows -> R {
68
68
#if DEBUG
69
- try await DependencyValues . $isSetting. withValue ( true ) {
70
- var dependencies = DependencyValues . _current
71
- try await updateValuesForOperation ( & dependencies)
72
- return try await DependencyValues . $_current. withValue ( dependencies) {
73
- try await DependencyValues . $isSetting. withValue ( false ) {
74
- let result = try await operation ( )
75
- if R . self is AnyClass {
76
- dependencyObjects. store ( result as AnyObject )
69
+ try await DependencyValues . $isSetting. withValue ( true ) {
70
+ var dependencies = DependencyValues . _current
71
+ try await updateValuesForOperation ( & dependencies)
72
+ return try await DependencyValues . $_current. withValue ( dependencies) {
73
+ try await DependencyValues . $isSetting. withValue ( false ) {
74
+ let result = try await operation ( )
75
+ if R . self is AnyClass {
76
+ dependencyObjects. store ( result as AnyObject )
77
+ }
78
+ return result
77
79
}
78
- return result
79
80
}
80
81
}
81
- }
82
82
#else
83
- var dependencies = DependencyValues . _current
84
- try await updateValuesForOperation ( & dependencies)
85
- return try await DependencyValues . $_current. withValue ( dependencies) {
86
- let result = try await operation ( )
87
- if R . self is AnyClass {
88
- dependencyObjects. store ( result as AnyObject )
83
+ var dependencies = DependencyValues . _current
84
+ try await updateValuesForOperation ( & dependencies)
85
+ return try await DependencyValues . $_current. withValue ( dependencies) {
86
+ let result = try await operation ( )
87
+ if R . self is AnyClass {
88
+ dependencyObjects. store ( result as AnyObject )
89
+ }
90
+ return result
89
91
}
90
- return result
91
- }
92
92
#endif
93
93
}
94
94
#else
@@ -483,11 +483,11 @@ private func isSetting<R>(
483
483
_ value: Bool ,
484
484
operation: ( ) throws -> R
485
485
) rethrows -> R {
486
- #if DEBUG
487
- try DependencyValues . $isSetting. withValue ( value, operation: operation)
488
- #else
489
- try operation ( )
490
- #endif
486
+ #if DEBUG
487
+ try DependencyValues . $isSetting. withValue ( value, operation: operation)
488
+ #else
489
+ try operation ( )
490
+ #endif
491
491
}
492
492
493
493
#if swift(<6)
0 commit comments