Skip to content

Commit 3d3c225

Browse files
committed
Renamed the BindingTarget.Value requirement.
1 parent 10b7118 commit 3d3c225

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

ReactiveCocoa/Swift/Property.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ public protocol PropertyProtocol: class {
2525
}
2626

2727
/// Represents an observable property that can be mutated directly.
28-
public protocol MutablePropertyProtocol: BindingTarget, PropertyProtocol {
28+
public protocol MutablePropertyProtocol: PropertyProtocol, BindingTarget {
2929
/// The current value of the property.
3030
var value: Value { get set }
3131
}
3232

3333
/// Default implementation of `MutablePropertyProtocol` for `BindingTarget`.
3434
extension MutablePropertyProtocol {
35-
public typealias ValueType = Value
36-
3735
public func consume(_ value: Value) {
3836
self.value = value
3937
}

ReactiveCocoa/Swift/UnidirectionalBinding.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ infix operator <~ : BindingPrecedence
1111

1212
/// Describes a target to which can be bound.
1313
public protocol BindingTarget: class {
14-
associatedtype ValueType
14+
associatedtype Value
1515

1616
/// The lifetime of `self`. The binding operators use this to determine when
1717
/// the binding should be teared down.
1818
var lifetime: Lifetime { get }
1919

2020
/// Consume a value from the binding.
21-
func consume(_ value: ValueType)
21+
func consume(_ value: Value)
2222

2323
/// Binds a signal to a target, updating the target's value to the latest
2424
/// value sent by the signal.
@@ -50,7 +50,7 @@ public protocol BindingTarget: class {
5050
/// deinitialization of the target or the signal's `completed`
5151
/// event.
5252
@discardableResult
53-
static func <~ <Source: SignalProtocol>(target: Self, signal: Source) -> Disposable? where Source.Value == ValueType, Source.Error == NoError
53+
static func <~ <Source: SignalProtocol>(target: Self, signal: Source) -> Disposable? where Source.Value == Value, Source.Error == NoError
5454
}
5555

5656
extension BindingTarget {
@@ -84,7 +84,7 @@ extension BindingTarget {
8484
/// deinitialization of the target or the signal's `completed`
8585
/// event.
8686
@discardableResult
87-
public static func <~ <Source: SignalProtocol>(target: Self, signal: Source) -> Disposable? where Source.Value == ValueType, Source.Error == NoError {
87+
public static func <~ <Source: SignalProtocol>(target: Self, signal: Source) -> Disposable? where Source.Value == Value, Source.Error == NoError {
8888
return signal
8989
.take(during: target.lifetime)
9090
.observeNext { [weak target] value in
@@ -123,7 +123,7 @@ extension BindingTarget {
123123
/// deinitialization of the target or the producer's `completed
124124
/// event.
125125
@discardableResult
126-
public static func <~ <Source: SignalProducerProtocol>(target: Self, producer: Source) -> Disposable where Source.Value == ValueType, Source.Error == NoError {
126+
public static func <~ <Source: SignalProducerProtocol>(target: Self, producer: Source) -> Disposable where Source.Value == Value, Source.Error == NoError {
127127
var disposable: Disposable!
128128

129129
producer
@@ -165,12 +165,12 @@ extension BindingTarget {
165165
/// - returns: A disposable that can be used to terminate binding before the
166166
/// deinitialization of the target or the source property.
167167
@discardableResult
168-
public static func <~ <Source: PropertyProtocol>(target: Self, property: Source) -> Disposable where Source.Value == ValueType {
168+
public static func <~ <Source: PropertyProtocol>(target: Self, property: Source) -> Disposable where Source.Value == Value {
169169
return target <~ property.producer
170170
}
171171
}
172172

173-
extension BindingTarget where ValueType: OptionalProtocol {
173+
extension BindingTarget where Value: OptionalProtocol {
174174
/// Binds a signal to a target, updating the target's value to the latest
175175
/// value sent by the signal.
176176
///
@@ -201,8 +201,8 @@ extension BindingTarget where ValueType: OptionalProtocol {
201201
/// deinitialization of the target or the signal's `completed`
202202
/// event.
203203
@discardableResult
204-
public static func <~ <Source: SignalProtocol>(target: Self, signal: Source) -> Disposable? where Source.Value == ValueType.Wrapped, Source.Error == NoError {
205-
return target <~ signal.map(ValueType.init(reconstructing:))
204+
public static func <~ <Source: SignalProtocol>(target: Self, signal: Source) -> Disposable? where Source.Value == Value.Wrapped, Source.Error == NoError {
205+
return target <~ signal.map(Value.init(reconstructing:))
206206
}
207207

208208
/// Binds a producer to a target, updating the target's value to the latest
@@ -236,8 +236,8 @@ extension BindingTarget where ValueType: OptionalProtocol {
236236
/// deinitialization of the target or the producer's `completed`
237237
/// event.
238238
@discardableResult
239-
public static func <~ <Source: SignalProducerProtocol>(target: Self, producer: Source) -> Disposable where Source.Value == ValueType.Wrapped, Source.Error == NoError {
240-
return target <~ producer.map(ValueType.init(reconstructing:))
239+
public static func <~ <Source: SignalProducerProtocol>(target: Self, producer: Source) -> Disposable where Source.Value == Value.Wrapped, Source.Error == NoError {
240+
return target <~ producer.map(Value.init(reconstructing:))
241241
}
242242

243243
/// Binds a property to a target, updating the target's value to the latest
@@ -272,7 +272,7 @@ extension BindingTarget where ValueType: OptionalProtocol {
272272
/// - returns: A disposable that can be used to terminate binding before the
273273
/// deinitialization of the target or the source property.
274274
@discardableResult
275-
public static func <~ <Source: PropertyProtocol>(target: Self, property: Source) -> Disposable where Source.Value == ValueType.Wrapped {
275+
public static func <~ <Source: PropertyProtocol>(target: Self, property: Source) -> Disposable where Source.Value == Value.Wrapped {
276276
return target <~ property.producer
277277
}
278278
}
@@ -311,3 +311,4 @@ public final class AnyBindingTarget<Value>: BindingTarget {
311311
sink(value)
312312
}
313313
}
314+

0 commit comments

Comments
 (0)