11import enum Result. NoError
22
3- infix operator <~ {
4- associativity right
3+ precedencegroup BindingPrecedence {
4+ associativity : right
55
66 // Binds tighter than assignment but looser than everything else
7- precedence 93
7+ higherThan : AssignmentPrecedence
88}
99
10- /// Describes a target to which can be bond.
10+ infix operator <~ : BindingPrecedence
11+
12+ /// Describes a target to which can be bound.
1113public protocol BindingTarget : class {
1214 associatedtype ValueType
1315
@@ -48,7 +50,7 @@ public protocol BindingTarget: class {
4850 /// deinitialization of the target or the signal's `completed`
4951 /// event.
5052 @discardableResult
51- static func <~ < Source: SignalProtocol where Source. Value == ValueType , Source. Error == NoError > ( target : Self , signal : Source ) -> Disposable ?
53+ static func <~ < Source: SignalProtocol > ( target : Self , signal : Source ) -> Disposable ? where Source. Value == ValueType , Source. Error == NoError
5254}
5355
5456extension BindingTarget {
@@ -82,7 +84,7 @@ extension BindingTarget {
8284 /// deinitialization of the target or the signal's `completed`
8385 /// event.
8486 @discardableResult
85- public static func <~ < Source: SignalProtocol where Source. Value == ValueType , Source. Error == NoError > ( target : Self , signal : Source ) -> Disposable ? {
87+ public static func <~ < Source: SignalProtocol > ( target : Self , signal : Source ) -> Disposable ? where Source. Value == ValueType , Source. Error == NoError {
8688 return signal
8789 . take ( during: target. lifetime)
8890 . observeNext { [ weak target] value in
@@ -121,7 +123,7 @@ extension BindingTarget {
121123 /// deinitialization of the target or the producer's `completed
122124 /// event.
123125 @discardableResult
124- public static func <~ < Source: SignalProducerProtocol where Source. Value == ValueType , Source. Error == NoError > ( target : Self , producer : Source ) -> Disposable {
126+ public static func <~ < Source: SignalProducerProtocol > ( target : Self , producer : Source ) -> Disposable where Source. Value == ValueType , Source. Error == NoError {
125127 var disposable : Disposable !
126128
127129 producer
@@ -163,7 +165,7 @@ extension BindingTarget {
163165 /// - returns: A disposable that can be used to terminate binding before the
164166 /// deinitialization of the target or the source property.
165167 @discardableResult
166- public static func <~ < Source: PropertyProtocol where Source . Value == ValueType > ( target: Self , property: Source ) -> Disposable {
168+ public static func <~ < Source: PropertyProtocol > ( target: Self , property: Source ) -> Disposable where Source . Value == ValueType {
167169 return target <~ property. producer
168170 }
169171}
@@ -199,7 +201,7 @@ extension BindingTarget where ValueType: OptionalProtocol {
199201 /// deinitialization of the target or the signal's `completed`
200202 /// event.
201203 @discardableResult
202- public static func <~ < Source: SignalProtocol where Source. Value == ValueType . Wrapped , Source. Error == NoError > ( target : Self , signal : Source ) -> Disposable ? {
204+ public static func <~ < Source: SignalProtocol > ( target : Self , signal : Source ) -> Disposable ? where Source. Value == ValueType . Wrapped , Source. Error == NoError {
203205 return target <~ signal. map ( ValueType . init ( reconstructing: ) )
204206 }
205207
@@ -234,7 +236,7 @@ extension BindingTarget where ValueType: OptionalProtocol {
234236 /// deinitialization of the target or the producer's `completed`
235237 /// event.
236238 @discardableResult
237- public static func <~ < Source: SignalProducerProtocol where Source. Value == ValueType . Wrapped , Source. Error == NoError > ( target : Self , producer : Source ) -> Disposable {
239+ public static func <~ < Source: SignalProducerProtocol > ( target : Self , producer : Source ) -> Disposable where Source. Value == ValueType . Wrapped , Source. Error == NoError {
238240 return target <~ producer. map ( ValueType . init ( reconstructing: ) )
239241 }
240242
@@ -270,16 +272,16 @@ extension BindingTarget where ValueType: OptionalProtocol {
270272 /// - returns: A disposable that can be used to terminate binding before the
271273 /// deinitialization of the target or the source property.
272274 @discardableResult
273- public static func <~ < Source: PropertyProtocol where Source . Value == ValueType . Wrapped > ( target: Self , property: Source ) -> Disposable {
275+ public static func <~ < Source: PropertyProtocol > ( target: Self , property: Source ) -> Disposable where Source . Value == ValueType . Wrapped {
274276 return target <~ property. producer
275277 }
276278}
277279
278280/// A type-erased view of a binding consumer.
279- public class AnyBindingTarget < Value> : BindingTarget {
281+ public final class AnyBindingTarget < Value> : BindingTarget {
280282 public typealias ValueType = Value
281283
282- let sink : ( Value ) -> ( )
284+ private let sink : @ escaping ( Value ) -> ( )
283285
284286 /// The lifetime of this binding consumer. The binding operators use this to
285287 /// determine whether or not the binding should be teared down.
@@ -289,7 +291,7 @@ public class AnyBindingTarget<Value>: BindingTarget {
289291 ///
290292 /// - parameter:
291293 /// - consumer: The binding consumer to be wrapped.
292- public init < U: BindingTarget where U. ValueType == Value > ( _ consumer : U ) {
294+ public init < U: BindingTarget > ( _ consumer : U ) where U. ValueType == Value {
293295 self . sink = consumer. consume
294296 self . lifetime = consumer. lifetime
295297 }
@@ -299,7 +301,7 @@ public class AnyBindingTarget<Value>: BindingTarget {
299301 /// - parameter:
300302 /// - sink: The sink to receive the values from the binding.
301303 /// - lifetime: The lifetime of the binding consumer.
302- public init ( sink: ( Value ) -> ( ) , lifetime: Lifetime ) {
304+ public init ( sink: @escaping ( Value ) -> ( ) , lifetime: Lifetime ) {
303305 self . sink = sink
304306 self . lifetime = lifetime
305307 }
0 commit comments