Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ build-all-platforms:
done;

test-swift:
swift test
swift test -c release
swift test -Xswiftc -D -Xswiftc EXCLUDE_EXPORTS
swift test -c release -Xswiftc -D -Xswiftc EXCLUDE_EXPORTS

test-linux:
docker run \
Expand Down
20 changes: 19 additions & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,20 @@ let package = Package(
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
)
#endif

for target in package.targets {
target.swiftSettings = target.swiftSettings ?? []
target.swiftSettings?.append(contentsOf: [
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("ImmutableWeakCaptures"),
.enableUpcomingFeature("InferIsolatedConformances"),
.enableUpcomingFeature("InternalImportsByDefault"),
.enableUpcomingFeature("MemberImportVisibility"),
.enableUpcomingFeature("NonisolatedNonsendingByDefault"),
])
#if compiler(>=6.4)
target.swiftSettings?.append(contentsOf: [
.treatAllWarnings(as: .error)
])
#endif
}
118 changes: 0 additions & 118 deletions Package@swift-5.9.swift

This file was deleted.

12 changes: 12 additions & 0 deletions Package@swift-6.0.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,15 @@ let package = Package(
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
)
#endif

for target in package.targets {
target.swiftSettings = target.swiftSettings ?? []
target.swiftSettings?.append(contentsOf: [
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("ImmutableWeakCaptures"),
.enableUpcomingFeature("InferIsolatedConformances"),
.enableUpcomingFeature("InternalImportsByDefault"),
.enableUpcomingFeature("MemberImportVisibility"),
.enableUpcomingFeature("NonisolatedNonsendingByDefault"),
])
}
6 changes: 3 additions & 3 deletions Sources/Dependencies/Dependency.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if canImport(SwiftUI)
import SwiftUI
public import SwiftUI
#endif

/// A property wrapper for accessing dependencies.
Expand Down Expand Up @@ -76,7 +76,7 @@ public struct Dependency<Value>: _HasInitialValues {
@Environment(\.dependencies) private var environmentValues
#endif

private let keyPath: SendableKeyPath<DependencyValues, Value>
private let keyPath: any SendableKeyPath<DependencyValues, Value>
private let filePath: StaticString
private let fileID: StaticString
private let line: UInt
Expand Down Expand Up @@ -105,7 +105,7 @@ public struct Dependency<Value>: _HasInitialValues {
/// - line: The source `#line` associated with the dependency.
/// - column: The source `#column` associated with the dependency.
public init(
_ keyPath: KeyPath<DependencyValues, Value> & Sendable,
_ keyPath: any KeyPath<DependencyValues, Value> & Sendable,
fileID: StaticString = #fileID,
filePath: StaticString = #filePath,
line: UInt = #line,
Expand Down
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyKey.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import IssueReporting

/// A key for accessing dependencies.
///
/// Types conform to this protocol to extend ``DependencyValues`` with custom dependencies. It is
Expand Down
4 changes: 2 additions & 2 deletions Sources/Dependencies/DependencyValues.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
public import Foundation
import IssueReporting

#if os(Windows)
Expand Down Expand Up @@ -144,7 +144,7 @@ public struct DependencyValues: Sendable {
guard
let XCTestObservation = objc_getProtocol("XCTestObservation"),
let XCTestObservationCenter = NSClassFromString("XCTestObservationCenter"),
let XCTestObservationCenter = XCTestObservationCenter as Any as? NSObjectProtocol,
let XCTestObservationCenter = XCTestObservationCenter as Any as? any NSObjectProtocol,
let XCTestObservationCenterShared =
XCTestObservationCenter
.perform(Selector(("sharedTestObservationCenter")))?
Expand Down
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/Assert.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import IssueReporting

extension DependencyValues {
/// A dependency for handling assertions.
///
Expand Down
76 changes: 38 additions & 38 deletions Sources/Dependencies/DependencyValues/Calendar.swift
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
#if Foundation
import Foundation
public import Foundation

extension DependencyValues {
/// The current calendar that features should use when handling dates.
///
/// By default, the calendar returned from `Calendar.autoupdatingCurrent` is supplied. When used
/// in a testing context, access will call to `reportIssue` when invoked, unless explicitly
/// overridden using ``withDependencies(_:operation:)-4uz6m``:
///
/// ```swift
/// // Provision model with overridden dependencies
/// let model = withDependencies {
/// $0.calendar = Calendar(identifier: .gregorian)
/// } operation: {
/// FeatureModel()
/// }
///
/// // Make assertions with model...
/// ```
public var calendar: Calendar {
get {
#if canImport(Darwin)
self[CalendarKey.self]
#else
self[CalendarKey.self].wrappedValue
#endif
extension DependencyValues {
/// The current calendar that features should use when handling dates.
///
/// By default, the calendar returned from `Calendar.autoupdatingCurrent` is supplied. When used
/// in a testing context, access will call to `reportIssue` when invoked, unless explicitly
/// overridden using ``withDependencies(_:operation:)-4uz6m``:
///
/// ```swift
/// // Provision model with overridden dependencies
/// let model = withDependencies {
/// $0.calendar = Calendar(identifier: .gregorian)
/// } operation: {
/// FeatureModel()
/// }
///
/// // Make assertions with model...
/// ```
public var calendar: Calendar {
get {
#if canImport(Darwin)
self[CalendarKey.self]
#else
self[CalendarKey.self].wrappedValue
#endif
}
set {
#if canImport(Darwin)
self[CalendarKey.self] = newValue
#else
self[CalendarKey.self].wrappedValue = newValue
#endif
}
}
set {

private enum CalendarKey: DependencyKey {
#if canImport(Darwin)
self[CalendarKey.self] = newValue
static let liveValue = Calendar.autoupdatingCurrent
#else
self[CalendarKey.self].wrappedValue = newValue
// NB: 'Calendar' sendability is not yet available in a 'swift-corelibs-foundation' release
static let liveValue = UncheckedSendable(Calendar.autoupdatingCurrent)
#endif
}
}

private enum CalendarKey: DependencyKey {
#if canImport(Darwin)
static let liveValue = Calendar.autoupdatingCurrent
#else
// NB: 'Calendar' sendability is not yet available in a 'swift-corelibs-foundation' release
static let liveValue = UncheckedSendable(Calendar.autoupdatingCurrent)
#endif
}
}
#endif
Loading
Loading