@@ -121,7 +121,7 @@ public struct ReadWriteBinding<Value>: Sendable {
121121 self . set = getSet. 1
122122 }
123123 /// Initializes a ``ReadWriteProxy`` from a ``ProxyBindable`` value, like `LockIsolated`.
124- public init < Bindable: ProxyBindable > ( _ bindable: Bindable ) where Bindable. Value == Value {
124+ public init < Bindable: ProxyBindable & Sendable > ( _ bindable: Bindable ) where Bindable. Value == Value {
125125 self . init (
126126 get: {
127127 bindable. getValue ( )
@@ -133,7 +133,7 @@ public struct ReadWriteBinding<Value>: Sendable {
133133 }
134134
135135 /// Initializes a ``ReadWriteProxy`` from a ``ProxyBindable`` value, like `LockIsolated`.
136- public static func bind< Bindable: ProxyBindable > ( bindable: Bindable ) -> Self
136+ public static func bind< Bindable: ProxyBindable & Sendable > ( bindable: Bindable ) -> Self
137137 where Bindable. Value == Value {
138138 . init( bindable)
139139 }
@@ -299,7 +299,7 @@ public struct MainActorReadWriteBinding<Value>: Sendable {
299299 self . set = getSet. 1
300300 }
301301
302- public init < Bindable: ProxyBindable > ( _ bindable: Bindable ) where Bindable. Value == Value {
302+ public init < Bindable: ProxyBindable & Sendable > ( _ bindable: Bindable ) where Bindable. Value == Value {
303303 self . init (
304304 get: {
305305 bindable. getValue ( )
@@ -422,23 +422,24 @@ public struct MainActorReadOnlyProxy<Value: Sendable>: Sendable {
422422///
423423/// `LockIsolated` is conforming to this protocol, so you can use `LockIsolated` values
424424/// to control writable dependencies properties during tests and SwiftUI previews.
425- @dynamicMemberLookup
425+ // @dynamicMemberLookup
426426public protocol ProxyBindable {
427427 associatedtype Value : Sendable
428428 var getValue : @Sendable ( ) -> Value { get }
429429 var setValue : @Sendable ( Value ) -> Void { get }
430430}
431431
432- extension ProxyBindable {
433- public subscript( dynamicMember keyPath: ReferenceWritableKeyPath < Self , Value > )
434- -> AnyProxyBindable < Value >
435- {
436- return AnyProxyBindable < Value > (
437- getValue: { self [ keyPath: keyPath] } ,
438- setValue: { self [ keyPath: keyPath] = $0 }
439- )
440- }
441- }
432+ // Removed for now until a proper way to handle the non-sendable capture is found
433+ //extension ProxyBindable {
434+ // public subscript(dynamicMember keyPath: ReferenceWritableKeyPath<Self, Value>)
435+ // -> AnyProxyBindable<Value>
436+ // {
437+ // return AnyProxyBindable<Value>(
438+ // getValue: { self[keyPath: keyPath] },
439+ // setValue: { self[keyPath: keyPath] = $0 }
440+ // )
441+ // }
442+ //}
442443
443444/// An erased ``ProxyBindable`` property.
444445///
@@ -447,12 +448,13 @@ extension ProxyBindable {
447448///
448449/// For example, `LockIsolated(["a", "b", "c"]).count` returns an ``AnyProxyBindable<Int>``
449450/// that you can bind to a writable dependency.
450- public struct AnyProxyBindable < Value> : ProxyBindable {
451+ public struct AnyProxyBindable < Value: Sendable > : ProxyBindable {
451452 public var getValue : @Sendable ( ) -> Value
452453 public var setValue : @Sendable ( Value ) -> Void
453454}
454455
455- extension LockIsolated : ProxyBindable {
456+ public protocol _Sendable : Sendable { }
457+ extension LockIsolated : ProxyBindable where Value: _Sendable {
456458 public var getValue : @Sendable ( ) -> Value {
457459 { self . value }
458460 }
0 commit comments