Skip to content

Commit 1c07db9

Browse files
authored
Fixes another Xcode 16 beta 6 problem. (#265)
* Fixes another Xcode 16 beta 6 problem. * Revert "Fixes another Xcode 16 beta 6 problem." This reverts commit cb7eed3. * wip
1 parent b96f13b commit 1c07db9

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

Dependencies.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/Dependencies/WithDependencies.swift

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ public func withDependencies<R>(
6565
_ updateValuesForOperation: (inout DependencyValues) async throws -> Void,
6666
operation: () async throws -> R
6767
) async rethrows -> R {
68-
try await isSetting(true) {
68+
#if DEBUG
69+
try await DependencyValues.$isSetting.withValue(true) {
6970
var dependencies = DependencyValues._current
7071
try await updateValuesForOperation(&dependencies)
7172
return try await DependencyValues.$_current.withValue(dependencies) {
72-
try await isSetting(false) {
73+
try await DependencyValues.$isSetting.withValue(false) {
7374
let result = try await operation()
7475
if R.self is AnyClass {
7576
dependencyObjects.store(result as AnyObject)
@@ -78,6 +79,17 @@ public func withDependencies<R>(
7879
}
7980
}
8081
}
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)
89+
}
90+
return result
91+
}
92+
#endif
8193
}
8294
#else
8395
@_unsafeInheritExecutor
@@ -471,27 +483,14 @@ private func isSetting<R>(
471483
_ value: Bool,
472484
operation: () throws -> R
473485
) rethrows -> R {
474-
#if DEBUG
475-
try DependencyValues.$isSetting.withValue(value, operation: operation)
476-
#else
477-
try operation()
478-
#endif
486+
#if DEBUG
487+
try DependencyValues.$isSetting.withValue(value, operation: operation)
488+
#else
489+
try operation()
490+
#endif
479491
}
480492

481-
#if swift(>=6)
482-
@_transparent
483-
private func isSetting<R>(
484-
_ value: Bool,
485-
isolation: isolated (any Actor)? = #isolation,
486-
operation: () async throws -> R
487-
) async rethrows -> R {
488-
#if DEBUG
489-
try await DependencyValues.$isSetting.withValue(value, operation: operation)
490-
#else
491-
try await operation()
492-
#endif
493-
}
494-
#else
493+
#if swift(<6)
495494
@_transparent
496495
private func isSetting<R>(
497496
_ value: Bool,

0 commit comments

Comments
 (0)