Skip to content

Commit

Permalink
Run swift-format
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis authored and github-actions[bot] committed Aug 26, 2024
1 parent 1c07db9 commit 3ef38bb
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions Sources/Dependencies/WithDependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,29 @@ public func withDependencies<R>(
operation: () async throws -> R
) async rethrows -> R {
#if DEBUG
try await DependencyValues.$isSetting.withValue(true) {
var dependencies = DependencyValues._current
try await updateValuesForOperation(&dependencies)
return try await DependencyValues.$_current.withValue(dependencies) {
try await DependencyValues.$isSetting.withValue(false) {
let result = try await operation()
if R.self is AnyClass {
dependencyObjects.store(result as AnyObject)
try await DependencyValues.$isSetting.withValue(true) {
var dependencies = DependencyValues._current
try await updateValuesForOperation(&dependencies)
return try await DependencyValues.$_current.withValue(dependencies) {
try await DependencyValues.$isSetting.withValue(false) {
let result = try await operation()
if R.self is AnyClass {
dependencyObjects.store(result as AnyObject)
}
return result
}
return result
}
}
}
#else
var dependencies = DependencyValues._current
try await updateValuesForOperation(&dependencies)
return try await DependencyValues.$_current.withValue(dependencies) {
let result = try await operation()
if R.self is AnyClass {
dependencyObjects.store(result as AnyObject)
var dependencies = DependencyValues._current
try await updateValuesForOperation(&dependencies)
return try await DependencyValues.$_current.withValue(dependencies) {
let result = try await operation()
if R.self is AnyClass {
dependencyObjects.store(result as AnyObject)
}
return result
}
return result
}
#endif
}
#else
Expand Down Expand Up @@ -483,11 +483,11 @@ private func isSetting<R>(
_ value: Bool,
operation: () throws -> R
) rethrows -> R {
#if DEBUG
try DependencyValues.$isSetting.withValue(value, operation: operation)
#else
try operation()
#endif
#if DEBUG
try DependencyValues.$isSetting.withValue(value, operation: operation)
#else
try operation()
#endif
}

#if swift(<6)
Expand Down

0 comments on commit 3ef38bb

Please sign in to comment.