RxSwift源码与模式分析一:基本类

原文链接: http://www.cnblogs.com/feng9exe/p/9004605.html

封装、变换与处理

// Represents a push style sequence.

public protocol ObservableType : ObservableConvertibleType {

      func subscribe(_ observer: O) -> Disposable where O.E == E

}

 

/// It represents a push style sequence.

public class Observable : ObservableType {

    public typealias E = Element

    

    public func subscribe(_ observer: O) -> Disposable where O.E == E {

        rxAbstractMethod()

    }

    

    public func asObservable() -> Observable {

        return self

    }

 

    /// Optimizations for map operator

    internal func composeMap(_ transform: @escaping (Element) throws -> R) -> Observable {

        return _map(source: self, transform: transform)

    }

}

 

public protocol ObserverType {

    associatedtype E

    func on(_ event: Event)

}

 

public enum Event {

    case next(Element)

    case error(Swift.Error)

    case completed

}

 

public struct Reactive {

    public let base: Base

    public init(_ base: Base) {

        self.base = base

    }

}

 

public struct Binder: ObserverType

 

转载于:https://www.cnblogs.com/feng9exe/p/9004605.html

你可能感兴趣的:(RxSwift源码与模式分析一:基本类)