diff --git a/Sources/SwiftDI/Intramodular/Core/withTaskDependencies.swift b/Sources/SwiftDI/Intramodular/Core/withTaskDependencies.swift index 3309507..1f33705 100644 --- a/Sources/SwiftDI/Intramodular/Core/withTaskDependencies.swift +++ b/Sources/SwiftDI/Intramodular/Core/withTaskDependencies.swift @@ -80,6 +80,28 @@ public func withTaskDependencies( ) async rethrows -> Result { try await withTaskDependencies({ _ in }, operation: operation) } +#elseif canImport(Translation) +@_transparent +@discardableResult +public func withDependency( + _ dependencyKey: WritableKeyPath, + _ dependency: Dependency, + operation: () async throws -> Result +) async rethrows -> Result { + try await withTaskDependencies { + $0[dependencyKey] = dependency + } operation: { + try await operation() + } +} + +@_transparent +@discardableResult +public func withTaskDependencies( + operation: () async throws -> Result +) async rethrows -> Result { + try await withTaskDependencies({ _ in }, operation: operation) +} #else @_transparent @_unsafeInheritExecutor