Skip to content

Commit

Permalink
Update E to Element in RxSwift
Browse files Browse the repository at this point in the history
  • Loading branch information
freak4pc authored and kzaher committed Apr 23, 2019
1 parent eef9a2d commit 991e955
Show file tree
Hide file tree
Showing 90 changed files with 691 additions and 695 deletions.
9 changes: 4 additions & 5 deletions Platform/DataStructures/InfiniteSequence.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
// //


/// Sequence that repeats `repeatedValue` infinite number of times. /// Sequence that repeats `repeatedValue` infinite number of times.
struct InfiniteSequence<E> : Sequence { struct InfiniteSequence<Element> : Sequence {
typealias Element = E typealias Iterator = AnyIterator<Element>
typealias Iterator = AnyIterator<E>


private let _repeatedValue: E private let _repeatedValue: Element


init(repeatedValue: E) { init(repeatedValue: Element) {
_repeatedValue = repeatedValue _repeatedValue = repeatedValue
} }


Expand Down
10 changes: 5 additions & 5 deletions RxSwift/AnyObserver.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/// Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type. /// Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type.
public struct AnyObserver<Element> : ObserverType { public struct AnyObserver<Element> : ObserverType {
/// The type of elements in sequence that observer can observe. /// The type of elements in sequence that observer can observe.
public typealias E = Element public typealias Element = Element


/// Anonymous event handler type. /// Anonymous event handler type.
public typealias EventHandler = (Event<Element>) -> Void public typealias EventHandler = (Event<Element>) -> Void
Expand All @@ -28,7 +28,7 @@ public struct AnyObserver<Element> : ObserverType {
/// Construct an instance whose `on(event)` calls `observer.on(event)` /// Construct an instance whose `on(event)` calls `observer.on(event)`
/// ///
/// - parameter observer: Observer that receives sequence events. /// - parameter observer: Observer that receives sequence events.
public init<O : ObserverType>(_ observer: O) where O.E == Element { public init<O : ObserverType>(_ observer: O) where O.Element == Element {
self.observer = observer.on self.observer = observer.on
} }


Expand All @@ -42,7 +42,7 @@ public struct AnyObserver<Element> : ObserverType {
/// Erases type of observer and returns canonical observer. /// Erases type of observer and returns canonical observer.
/// ///
/// - returns: type erased observer. /// - returns: type erased observer.
public func asObserver() -> AnyObserver<E> { public func asObserver() -> AnyObserver<Element> {
return self return self
} }
} }
Expand All @@ -56,15 +56,15 @@ extension ObserverType {
/// Erases type of observer and returns canonical observer. /// Erases type of observer and returns canonical observer.
/// ///
/// - returns: type erased observer. /// - returns: type erased observer.
public func asObserver() -> AnyObserver<E> { public func asObserver() -> AnyObserver<Element> {
return AnyObserver(self) return AnyObserver(self)
} }


/// Transforms observer of type R to type E using custom transform method. /// Transforms observer of type R to type E using custom transform method.
/// Each event sent to result observer is transformed and sent to `self`. /// Each event sent to result observer is transformed and sent to `self`.
/// ///
/// - returns: observer that transforms events. /// - returns: observer that transforms events.
public func mapObserver<R>(_ transform: @escaping (R) throws -> E) -> AnyObserver<R> { public func mapObserver<R>(_ transform: @escaping (R) throws -> Element) -> AnyObserver<R> {
return AnyObserver { e in return AnyObserver { e in
self.on(e.map(transform)) self.on(e.map(transform))
} }
Expand Down
4 changes: 2 additions & 2 deletions RxSwift/Concurrency/SynchronizedOnType.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// //


protocol SynchronizedOnType : class, ObserverType, Lock { protocol SynchronizedOnType : class, ObserverType, Lock {
func _synchronized_on(_ event: Event<E>) func _synchronized_on(_ event: Event<Element>)
} }


extension SynchronizedOnType { extension SynchronizedOnType {
func synchronizedOn(_ event: Event<E>) { func synchronizedOn(_ event: Event<Element>) {
self.lock(); defer { self.unlock() } self.lock(); defer { self.unlock() }
self._synchronized_on(event) self._synchronized_on(event)
} }
Expand Down
52 changes: 26 additions & 26 deletions RxSwift/Deprecated.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension Observable {
- returns: An observable sequence containing the wrapped value or not from given optional. - returns: An observable sequence containing the wrapped value or not from given optional.
*/ */
@available(*, deprecated, message: "Implicit conversions from any type to optional type are allowed and that is causing issues with `from` operator overloading.", renamed: "from(optional:)") @available(*, deprecated, message: "Implicit conversions from any type to optional type are allowed and that is causing issues with `from` operator overloading.", renamed: "from(optional:)")
public static func from(_ optional: E?) -> Observable<E> { public static func from(_ optional: Element?) -> Observable<Element> {
return Observable.from(optional: optional) return Observable.from(optional: optional)
} }


Expand All @@ -32,7 +32,7 @@ extension Observable {
- returns: An observable sequence containing the wrapped value or not from given optional. - returns: An observable sequence containing the wrapped value or not from given optional.
*/ */
@available(*, deprecated, message: "Implicit conversions from any type to optional type are allowed and that is causing issues with `from` operator overloading.", renamed: "from(optional:scheduler:)") @available(*, deprecated, message: "Implicit conversions from any type to optional type are allowed and that is causing issues with `from` operator overloading.", renamed: "from(optional:scheduler:)")
public static func from(_ optional: E?, scheduler: ImmediateSchedulerType) -> Observable<E> { public static func from(_ optional: Element?, scheduler: ImmediateSchedulerType) -> Observable<Element> {
return Observable.from(optional: optional, scheduler: scheduler) return Observable.from(optional: optional, scheduler: scheduler)
} }
} }
Expand All @@ -48,7 +48,7 @@ extension ObservableType {
- returns: An observable sequence whose elements are the result of invoking the transform function on each element of source. - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/ */
@available(*, deprecated, message: "Please use enumerated().map()") @available(*, deprecated, message: "Please use enumerated().map()")
public func mapWithIndex<R>(_ selector: @escaping (E, Int) throws -> R) public func mapWithIndex<R>(_ selector: @escaping (Element, Int) throws -> R)
-> Observable<R> { -> Observable<R> {
return self.enumerated().map { try selector($0.element, $0.index) } return self.enumerated().map { try selector($0.element, $0.index) }
} }
Expand All @@ -64,8 +64,8 @@ extension ObservableType {
- returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence. - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.
*/ */
@available(*, deprecated, message: "Please use enumerated().flatMap()") @available(*, deprecated, message: "Please use enumerated().flatMap()")
public func flatMapWithIndex<O: ObservableConvertibleType>(_ selector: @escaping (E, Int) throws -> O) public func flatMapWithIndex<O: ObservableConvertibleType>(_ selector: @escaping (Element, Int) throws -> O)
-> Observable<O.E> { -> Observable<O.Element> {
return self.enumerated().flatMap { try selector($0.element, $0.index) } return self.enumerated().flatMap { try selector($0.element, $0.index) }
} }


Expand All @@ -80,7 +80,7 @@ extension ObservableType {
- returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate. - returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/ */
@available(*, deprecated, message: "Please use enumerated().skipWhile().map()") @available(*, deprecated, message: "Please use enumerated().skipWhile().map()")
public func skipWhileWithIndex(_ predicate: @escaping (E, Int) throws -> Bool) -> Observable<E> { public func skipWhileWithIndex(_ predicate: @escaping (Element, Int) throws -> Bool) -> Observable<Element> {
return self.enumerated().skipWhile { try predicate($0.element, $0.index) }.map { $0.element } return self.enumerated().skipWhile { try predicate($0.element, $0.index) }.map { $0.element }
} }


Expand All @@ -97,7 +97,7 @@ extension ObservableType {
- returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes. - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/ */
@available(*, deprecated, message: "Please use enumerated().takeWhile().map()") @available(*, deprecated, message: "Please use enumerated().takeWhile().map()")
public func takeWhileWithIndex(_ predicate: @escaping (E, Int) throws -> Bool) -> Observable<E> { public func takeWhileWithIndex(_ predicate: @escaping (Element, Int) throws -> Bool) -> Observable<Element> {
return self.enumerated().takeWhile { try predicate($0.element, $0.index) }.map { $0.element } return self.enumerated().takeWhile { try predicate($0.element, $0.index) }.map { $0.element }
} }
} }
Expand Down Expand Up @@ -129,7 +129,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "use share(replay: 1) instead", renamed: "share(replay:)") @available(*, deprecated, message: "use share(replay: 1) instead", renamed: "share(replay:)")
public func shareReplayLatestWhileConnected() public func shareReplayLatestWhileConnected()
-> Observable<E> { -> Observable<Element> {
return self.share(replay: 1, scope: .whileConnected) return self.share(replay: 1, scope: .whileConnected)
} }
} }
Expand All @@ -149,7 +149,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Suggested replacement is `share(replay: 1)`. In case old 3.x behavior of `shareReplay` is required please use `share(replay: 1, scope: .forever)` instead.", renamed: "share(replay:)") @available(*, deprecated, message: "Suggested replacement is `share(replay: 1)`. In case old 3.x behavior of `shareReplay` is required please use `share(replay: 1, scope: .forever)` instead.", renamed: "share(replay:)")
public func shareReplay(_ bufferSize: Int) public func shareReplay(_ bufferSize: Int)
-> Observable<E> { -> Observable<Element> {
return self.share(replay: bufferSize, scope: .forever) return self.share(replay: bufferSize, scope: .forever)
} }
} }
Expand All @@ -172,14 +172,14 @@ extension ObservableType {
@available(*, deprecated, message: "Variable is deprecated. Please use `BehaviorRelay` as a replacement.") @available(*, deprecated, message: "Variable is deprecated. Please use `BehaviorRelay` as a replacement.")
public final class Variable<Element> { public final class Variable<Element> {


public typealias E = Element public typealias Element = Element


private let _subject: BehaviorSubject<Element> private let _subject: BehaviorSubject<Element>


private var _lock = SpinLock() private var _lock = SpinLock()


// state // state
private var _value: E private var _value: Element


#if DEBUG #if DEBUG
fileprivate let _synchronizationTracker = SynchronizationTracker() fileprivate let _synchronizationTracker = SynchronizationTracker()
Expand All @@ -190,7 +190,7 @@ public final class Variable<Element> {
/// Whenever a new value is set, all the observers are notified of the change. /// Whenever a new value is set, all the observers are notified of the change.
/// ///
/// Even if the newly set value is same as the old value, observers are still notified for change. /// Even if the newly set value is same as the old value, observers are still notified for change.
public var value: E { public var value: Element {
get { get {
self._lock.lock(); defer { self._lock.unlock() } self._lock.lock(); defer { self._lock.unlock() }
return self._value return self._value
Expand All @@ -217,7 +217,7 @@ public final class Variable<Element> {
} }


/// - returns: Canonical interface for push style sequence /// - returns: Canonical interface for push style sequence
public func asObservable() -> Observable<E> { public func asObservable() -> Observable<Element> {
return self._subject return self._subject
} }


Expand All @@ -238,7 +238,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "delay(_:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "delay(_:scheduler:)")
public func delay(_ dueTime: Foundation.TimeInterval, scheduler: SchedulerType) public func delay(_ dueTime: Foundation.TimeInterval, scheduler: SchedulerType)
-> Observable<E> { -> Observable<Element> {
return self.delay(.milliseconds(Int(dueTime * 1000.0)), scheduler: scheduler) return self.delay(.milliseconds(Int(dueTime * 1000.0)), scheduler: scheduler)
} }
} }
Expand All @@ -256,7 +256,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "timeout(_:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "timeout(_:scheduler:)")
public func timeout(_ dueTime: Foundation.TimeInterval, scheduler: SchedulerType) public func timeout(_ dueTime: Foundation.TimeInterval, scheduler: SchedulerType)
-> Observable<E> { -> Observable<Element> {
return timeout(.milliseconds(Int(dueTime * 1000.0)), scheduler: scheduler) return timeout(.milliseconds(Int(dueTime * 1000.0)), scheduler: scheduler)
} }


Expand All @@ -272,7 +272,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "timeout(_:other:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "timeout(_:other:scheduler:)")
public func timeout<O: ObservableConvertibleType>(_ dueTime: Foundation.TimeInterval, other: O, scheduler: SchedulerType) public func timeout<O: ObservableConvertibleType>(_ dueTime: Foundation.TimeInterval, other: O, scheduler: SchedulerType)
-> Observable<E> where E == O.E { -> Observable<Element> where Element == O.Element {
return timeout(.milliseconds(Int(dueTime * 1000.0)), other: other, scheduler: scheduler) return timeout(.milliseconds(Int(dueTime * 1000.0)), other: other, scheduler: scheduler)
} }
} }
Expand All @@ -290,12 +290,12 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "skip(_:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "skip(_:scheduler:)")
public func skip(_ duration: Foundation.TimeInterval, scheduler: SchedulerType) public func skip(_ duration: Foundation.TimeInterval, scheduler: SchedulerType)
-> Observable<E> { -> Observable<Element> {
return skip(.milliseconds(Int(duration * 1000.0)), scheduler: scheduler) return skip(.milliseconds(Int(duration * 1000.0)), scheduler: scheduler)
} }
} }


extension ObservableType where E : RxAbstractInteger { extension ObservableType where Element : RxAbstractInteger {
/** /**
Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages. Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.
Expand All @@ -307,12 +307,12 @@ extension ObservableType where E : RxAbstractInteger {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "interval(_:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "interval(_:scheduler:)")
public static func interval(_ period: Foundation.TimeInterval, scheduler: SchedulerType) public static func interval(_ period: Foundation.TimeInterval, scheduler: SchedulerType)
-> Observable<E> { -> Observable<Element> {
return interval(.milliseconds(Int(period * 1000.0)), scheduler: scheduler) return interval(.milliseconds(Int(period * 1000.0)), scheduler: scheduler)
} }
} }


extension ObservableType where E: RxAbstractInteger { extension ObservableType where Element: RxAbstractInteger {
/** /**
Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers. Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.
Expand All @@ -325,7 +325,7 @@ extension ObservableType where E: RxAbstractInteger {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "timer(_:period:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "timer(_:period:scheduler:)")
public static func timer(_ dueTime: Foundation.TimeInterval, period: Foundation.TimeInterval? = nil, scheduler: SchedulerType) public static func timer(_ dueTime: Foundation.TimeInterval, period: Foundation.TimeInterval? = nil, scheduler: SchedulerType)
-> Observable<E> { -> Observable<Element> {
return timer(.milliseconds(Int(dueTime * 1000.0)), period: period.map { .milliseconds(Int($0 * 1000.0)) }, scheduler: scheduler) return timer(.milliseconds(Int(dueTime * 1000.0)), period: period.map { .milliseconds(Int($0 * 1000.0)) }, scheduler: scheduler)
} }
} }
Expand All @@ -346,7 +346,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "throttle(_:latest:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "throttle(_:latest:scheduler:)")
public func throttle(_ dueTime: Foundation.TimeInterval, latest: Bool = true, scheduler: SchedulerType) public func throttle(_ dueTime: Foundation.TimeInterval, latest: Bool = true, scheduler: SchedulerType)
-> Observable<E> { -> Observable<Element> {
return throttle(.milliseconds(Int(dueTime * 1000.0)), latest: latest, scheduler: scheduler) return throttle(.milliseconds(Int(dueTime * 1000.0)), latest: latest, scheduler: scheduler)
} }
} }
Expand All @@ -364,7 +364,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "take(_:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "take(_:scheduler:)")
public func take(_ duration: Foundation.TimeInterval, scheduler: SchedulerType) public func take(_ duration: Foundation.TimeInterval, scheduler: SchedulerType)
-> Observable<E> { -> Observable<Element> {
return take(.milliseconds(Int(duration * 1000.0)), scheduler: scheduler) return take(.milliseconds(Int(duration * 1000.0)), scheduler: scheduler)
} }
} }
Expand All @@ -383,7 +383,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "delaySubscription(_:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "delaySubscription(_:scheduler:)")
public func delaySubscription(_ dueTime: Foundation.TimeInterval, scheduler: SchedulerType) public func delaySubscription(_ dueTime: Foundation.TimeInterval, scheduler: SchedulerType)
-> Observable<E> { -> Observable<Element> {
return delaySubscription(.milliseconds(Int(dueTime * 1000.0)), scheduler: scheduler) return delaySubscription(.milliseconds(Int(dueTime * 1000.0)), scheduler: scheduler)
} }
} }
Expand All @@ -402,7 +402,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "window(_:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "window(_:)")
public func window(timeSpan: Foundation.TimeInterval, count: Int, scheduler: SchedulerType) public func window(timeSpan: Foundation.TimeInterval, count: Int, scheduler: SchedulerType)
-> Observable<Observable<E>> { -> Observable<Observable<Element>> {
return window(timeSpan: .milliseconds(Int(timeSpan * 1000.0)), count: count, scheduler: scheduler) return window(timeSpan: .milliseconds(Int(timeSpan * 1000.0)), count: count, scheduler: scheduler)
} }
} }
Expand Down Expand Up @@ -518,7 +518,7 @@ extension ObservableType {
*/ */
@available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "buffer(timeSpan:count:scheduler:)") @available(*, deprecated, message: "Use DispatchTimeInterval overload instead.", renamed: "buffer(timeSpan:count:scheduler:)")
public func buffer(timeSpan: Foundation.TimeInterval, count: Int, scheduler: SchedulerType) public func buffer(timeSpan: Foundation.TimeInterval, count: Int, scheduler: SchedulerType)
-> Observable<[E]> { -> Observable<[Element]> {
return buffer(timeSpan: .milliseconds(Int(timeSpan * 1000.0)), count: count, scheduler: scheduler) return buffer(timeSpan: .milliseconds(Int(timeSpan * 1000.0)), count: count, scheduler: scheduler)
} }
} }
Expand Down
4 changes: 2 additions & 2 deletions RxSwift/Event.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public enum Event<Element> {
case completed case completed
} }


extension Event : CustomDebugStringConvertible { extension Event: CustomDebugStringConvertible {
/// Description of event. /// Description of event.
public var debugDescription: String { public var debugDescription: String {
switch self { switch self {
Expand Down Expand Up @@ -98,7 +98,7 @@ public protocol EventConvertible {
var event: Event<ElementType> { get } var event: Event<ElementType> { get }
} }


extension Event : EventConvertible { extension Event: EventConvertible {
/// Event representation of this instance /// Event representation of this instance
public var event: Event<Element> { public var event: Event<Element> {
return self return self
Expand Down
2 changes: 1 addition & 1 deletion RxSwift/Extensions/Bag+Rx.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// MARK: forEach // MARK: forEach


@inline(__always) @inline(__always)
func dispatch<E>(_ bag: Bag<(Event<E>) -> Void>, _ event: Event<E>) { func dispatch<Element>(_ bag: Bag<(Event<Element>) -> Void>, _ event: Event<Element>) {
bag._value0?(event) bag._value0?(event)


if bag._onlyFastPath { if bag._onlyFastPath {
Expand Down
4 changes: 2 additions & 2 deletions RxSwift/GroupedObservable.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


/// Represents an observable sequence of elements that have a common key. /// Represents an observable sequence of elements that have a common key.
public struct GroupedObservable<Key, Element> : ObservableType { public struct GroupedObservable<Key, Element> : ObservableType {
public typealias E = Element public typealias Element = Element


/// Gets the common key. /// Gets the common key.
public let key: Key public let key: Key
Expand All @@ -26,7 +26,7 @@ public struct GroupedObservable<Key, Element> : ObservableType {
} }


/// Subscribes `observer` to receive events for this sequence. /// Subscribes `observer` to receive events for this sequence.
public func subscribe<O : ObserverType>(_ observer: O) -> Disposable where O.E == E { public func subscribe<O : ObserverType>(_ observer: O) -> Disposable where O.Element == Element {
return self.source.subscribe(observer) return self.source.subscribe(observer)
} }


Expand Down
7 changes: 2 additions & 5 deletions RxSwift/Observable.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,20 +10,17 @@
/// ///
/// It represents a push style sequence. /// It represents a push style sequence.
public class Observable<Element> : ObservableType { public class Observable<Element> : ObservableType {
/// Type of elements in sequence.
public typealias E = Element

init() { init() {
#if TRACE_RESOURCES #if TRACE_RESOURCES
_ = Resources.incrementTotal() _ = Resources.incrementTotal()
#endif #endif
} }


public func subscribe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E { public func subscribe<O: ObserverType>(_ observer: O) -> Disposable where O.Element == Element {
rxAbstractMethod() rxAbstractMethod()
} }


public func asObservable() -> Observable<E> { public func asObservable() -> Observable<Element> {
return self return self
} }


Expand Down
6 changes: 3 additions & 3 deletions RxSwift/ObservableType+Extensions.swift
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension ObservableType {
- parameter on: Action to invoke for each event in the observable sequence. - parameter on: Action to invoke for each event in the observable sequence.
- returns: Subscription object used to unsubscribe from the observable sequence. - returns: Subscription object used to unsubscribe from the observable sequence.
*/ */
public func subscribe(_ on: @escaping (Event<E>) -> Void) public func subscribe(_ on: @escaping (Event<Element>) -> Void)
-> Disposable { -> Disposable {
let observer = AnonymousObserver { e in let observer = AnonymousObserver { e in
on(e) on(e)
Expand All @@ -36,7 +36,7 @@ extension ObservableType {
gracefully completed, errored, or if the generation is canceled by disposing subscription). gracefully completed, errored, or if the generation is canceled by disposing subscription).
- returns: Subscription object used to unsubscribe from the observable sequence. - returns: Subscription object used to unsubscribe from the observable sequence.
*/ */
public func subscribe(onNext: ((E) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil) public func subscribe(onNext: ((Element) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil)
-> Disposable { -> Disposable {
let disposable: Disposable let disposable: Disposable


Expand All @@ -53,7 +53,7 @@ extension ObservableType {


let callStack = Hooks.recordCallStackOnError ? Hooks.customCaptureSubscriptionCallstack() : [] let callStack = Hooks.recordCallStackOnError ? Hooks.customCaptureSubscriptionCallstack() : []


let observer = AnonymousObserver<E> { event in let observer = AnonymousObserver<Element> { event in


#if DEBUG #if DEBUG
synchronizationTracker.register(synchronizationErrorMessage: .default) synchronizationTracker.register(synchronizationErrorMessage: .default)
Expand Down
Loading

0 comments on commit 991e955

Please sign in to comment.