Skip to content

Commit f89d9e1

Browse files
committed
Weaken unavailable setter to deprecated
Swift <6.3 had a soundness hole that allowed these writes to happen _via_, _e.g._, dynamic member lookup. This is quite disruptive to existing code bases, so let's warn instead, clearly noting a potential data race, and allow folks to continue building.
1 parent c6216db commit f89d9e1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Sources/Sharing/Shared.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ public struct Shared<Value> {
106106
}
107107
@available(
108108
*,
109-
unavailable,
110-
message: "Use '$shared.withLock' to modify a shared value with exclusive access."
109+
deprecated,
110+
message: """
111+
Use '$shared.withLock' to modify a shared value with exclusive access; when constructing a SwiftUI binding, use 'Binding($shared)'
112+
"""
111113
)
112114
nonmutating set {
113115
withLock { $0 = newValue }

0 commit comments

Comments
 (0)