Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
strategy:
matrix:
swift:
- '6.0'
- '6.1'
name: Ubuntu (Swift ${{ matrix.swift }})
runs-on: ubuntu-latest
container: swift:${{ matrix.swift }}
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.1

import CompilerPluginSupport
import PackageDescription
Expand Down
113 changes: 0 additions & 113 deletions Package@swift-5.9.swift

This file was deleted.

10 changes: 2 additions & 8 deletions Sources/Dependencies/Dependency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@
///
/// [tca]: https://github.com/pointfreeco/swift-composable-architecture
@propertyWrapper
public struct Dependency<Value>: _HasInitialValues {
public struct Dependency<Value>: _HasInitialValues, Sendable {
let initialValues: DependencyValues = DependencyValues._current
private var installValues: DependencyValues?
#if canImport(SwiftUI)
@Environment(\.dependencies) private var environmentValues
#endif

private let keyPath: SendableKeyPath<DependencyValues, Value>
private let keyPath: KeyPath<DependencyValues, Value> & Sendable
private let filePath: StaticString
private let fileID: StaticString
private let line: UInt
Expand Down Expand Up @@ -201,12 +201,6 @@ public struct Dependency<Value>: _HasInitialValues {
}
}

#if compiler(>=6)
extension Dependency: Sendable {}
#else
extension Dependency: @unchecked Sendable {}
#endif

#if canImport(SwiftUI)
extension Dependency: DynamicProperty {
public mutating func update() {
Expand Down
15 changes: 1 addition & 14 deletions Sources/Dependencies/DependencyValues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -598,20 +598,7 @@ public final class CachedValues: @unchecked Sendable {
value = Key.previewValue
}
case .test:
#if compiler(<6.1)
if !CachedValues.isAccessingCachedDependencies,
case .swiftTesting(.some(let testing)) = TestContext.current,
let testValues = testValuesByTestID.withValue({ $0[testing.test.id.rawValue] })
{
value = CachedValues.$isAccessingCachedDependencies.withValue(true) {
testValues[key]
}
} else {
value = Key.testValue
}
#else
value = Key.testValue
#endif
value = Key.testValue
}

let cacheableValue = value ?? Key.testValue
Expand Down
26 changes: 0 additions & 26 deletions Sources/Dependencies/Documentation.docc/Articles/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,30 +315,4 @@ class Model {
You will not be able to override this dependency in the normal fashion. In general there is no need
to ever have a static dependency, and so you should avoid this pattern.

### Parameterized and repeated @Test runs

> Important: If targeting Swift 6.1+ (Xcode 16.3+), then this gotcha does not apply and can be
> ignored.

The library comes with support for Swift's new native Testing framework. However, as there are still
still features missing from the Testing framework that XCTest has, there may be some additional
steps you must take.

If you are are writing a _parameterized_ test using the `@Test` macro, you will need to surround the
entire body of your test in [`withDependencies`](<doc:withDependencies(_:operation:)>) that
resets the entire set of values to guarantee that a fresh set of dependencies is used per parameter:

```swift
@Test(arguments: [1, 2, 3])
func feature(_ number: Int) {
withDependencies {
$0 = DependencyValues()
} operation: {
// All test code in here...
}
}
```

This will guarantee that dependency state does not bleed over to each parameter of the test.

[issue-reporting-gh]: http://github.com/pointfreeco/swift-issue-reporting
2 changes: 1 addition & 1 deletion Sources/Dependencies/Internal/Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// MARK: - Deprecated after 1.9.2

#if canImport(SwiftUI) && compiler(>=6)
#if canImport(SwiftUI)
@available(iOS 18, macOS 15, tvOS 18, watchOS 11, visionOS 2, *)
extension PreviewTrait where T == Preview.ViewTraits {
@available(
Expand Down
5 changes: 0 additions & 5 deletions Sources/Dependencies/Internal/SendableKeyPath.swift

This file was deleted.

3 changes: 0 additions & 3 deletions Sources/Dependencies/Traits/TestTrait.swift

This file was deleted.

Loading