Merge pull request #578 from tarunon/feature/drive_to_variable

Adding drive to Variable operator to Driver
This commit is contained in:
Krunoslav Zaher 2016-03-28 22:11:50 +02:00
commit 7dffae6dc8
1 changed files with 13 additions and 0 deletions

View File

@ -26,6 +26,19 @@ extension DriverConvertibleType {
return self.asObservable().subscribe(observer)
}
/**
Creates new subscription and sends elements to variable.
- parameter variable: Target variable for sequence elements.
- returns: Disposable object that can be used to unsubscribe the observer from the variable.
*/
@warn_unused_result(message="http://git.io/rxs.ud")
public func drive(variable: Variable<E>) -> Disposable {
return drive(onNext: { e in
variable.value = e
})
}
/**
Subscribes to observable sequence using custom binder function.