封装、变换与处理
// Represents a push style sequence.
public protocol ObservableType : ObservableConvertibleType {
func subscribe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E
}
/// It represents a push style sequence.
public class Observable<Element> : ObservableType {
public typealias E = Element
public func subscribe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E {
rxAbstractMethod()
}
public func asObservable() -> Observable<E> {
return self
}
/// Optimizations for map operator
internal func composeMap<R>(_ transform: @escaping (Element) throws -> R) -> Observable<R> {
return _map(source: self, transform: transform)
}
}
public protocol ObserverType {
associatedtype E
func on(_ event: Event<E>)
}
public enum Event<Element> {
case next(Element)
case error(Swift.Error)
case completed
}
public struct Reactive<Base> {
public let base: Base
public init(_ base: Base) {
self.base = base
}
}
public struct Binder<Value>: ObserverType