We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 94887a3 commit dbcd9d4Copy full SHA for dbcd9d4
Sources/Sharing/Shared.swift
@@ -102,6 +102,7 @@ public struct Shared<Value> {
102
/// }
103
104
/// ```
105
+ #if compiler(>=6)
106
public var wrappedValue: Value {
107
get {
108
@Dependency(\.snapshots) var snapshots
@@ -120,6 +121,16 @@ public struct Shared<Value> {
120
121
withLock { $0 = newValue }
122
}
123
124
+ #else
125
+ public var wrappedValue: Value {
126
+ @Dependency(\.snapshots) var snapshots
127
+ if snapshots.isAsserting {
128
+ return reference.snapshot ?? reference.wrappedValue
129
+ } else {
130
+ return reference.wrappedValue
131
+ }
132
133
+ #endif
134
135
/// Perform an operation on shared state with isolated access to the underlying value.
136
///
0 commit comments