mirror of
https://github.com/ReactiveX/RxSwift.git
synced 2024-10-05 06:27:29 +03:00
Correct mixed indentation by replacing tabs with spaces
This commit is contained in:
parent
6df77da474
commit
2b0dd31a9f
@ -17,14 +17,14 @@ var rx_tap_key: UInt8 = 0
|
||||
|
||||
extension UIBarButtonItem {
|
||||
|
||||
/**
|
||||
Bindable sink for `enabled` property.
|
||||
*/
|
||||
public var rx_enabled: AnyObserver<Bool> {
|
||||
/**
|
||||
Bindable sink for `enabled` property.
|
||||
*/
|
||||
public var rx_enabled: AnyObserver<Bool> {
|
||||
return UIBindingObserver(UIElement: self) { UIElement, value in
|
||||
UIElement.enabled = value
|
||||
}.asObserver()
|
||||
}
|
||||
}.asObserver()
|
||||
}
|
||||
|
||||
/**
|
||||
Reactive wrapper for target action pattern on `self`.
|
||||
|
@ -20,7 +20,7 @@ extension UIButton {
|
||||
Reactive wrapper for `TouchUpInside` control event.
|
||||
*/
|
||||
public var rx_tap: ControlEvent<Void> {
|
||||
return rx_controlEvent(.TouchUpInside)
|
||||
return rx_controlEvent(.TouchUpInside)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ protocol ImageService {
|
||||
|
||||
class DefaultImageService: ImageService {
|
||||
|
||||
static let sharedImageService = DefaultImageService() // Singleton
|
||||
static let sharedImageService = DefaultImageService() // Singleton
|
||||
|
||||
let $: Dependencies = Dependencies.sharedDependencies
|
||||
let $: Dependencies = Dependencies.sharedDependencies
|
||||
|
||||
// 1st level cache
|
||||
private let _imageCache = NSCache()
|
||||
|
@ -93,20 +93,20 @@ extension ObservableType {
|
||||
return self.multicast(ReplaySubject.create(bufferSize: bufferSize))
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all elements.
|
||||
/**
|
||||
Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all elements.
|
||||
|
||||
This operator is a specialization of `multicast` using a `ReplaySubject`.
|
||||
This operator is a specialization of `multicast` using a `ReplaySubject`.
|
||||
|
||||
- seealso: [replay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html)
|
||||
|
||||
- returns: A connectable observable sequence that shares a single subscription to the underlying sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func replayAll()
|
||||
-> ConnectableObservable<E> {
|
||||
- returns: A connectable observable sequence that shares a single subscription to the underlying sequence.
|
||||
*/
|
||||
@warn_unused_result(message="http://git.io/rxs.uo")
|
||||
public func replayAll()
|
||||
-> ConnectableObservable<E> {
|
||||
return self.multicast(ReplaySubject.createUnbounded())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: refcount
|
||||
|
@ -63,14 +63,14 @@ public class ReplaySubject<Element>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a new instance of `ReplaySubject` that buffers all the elements of a sequence.
|
||||
To avoid filling up memory, developer needs to make sure that the use case will only ever store a 'reasonable'
|
||||
number of elements.
|
||||
*/
|
||||
public static func createUnbounded() -> ReplaySubject<Element> {
|
||||
return ReplayAll()
|
||||
}
|
||||
/**
|
||||
Creates a new instance of `ReplaySubject` that buffers all the elements of a sequence.
|
||||
To avoid filling up memory, developer needs to make sure that the use case will only ever store a 'reasonable'
|
||||
number of elements.
|
||||
*/
|
||||
public static func createUnbounded() -> ReplaySubject<Element> {
|
||||
return ReplayAll()
|
||||
}
|
||||
}
|
||||
|
||||
class ReplayBufferBase<Element>
|
||||
|
@ -677,226 +677,226 @@ extension ObservableBindingTest {
|
||||
])
|
||||
}
|
||||
|
||||
func testReplayAll_Basic() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
func testReplayAll_Basic() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
|
||||
let xs = scheduler.createHotObservable([
|
||||
next(110, 7),
|
||||
next(220, 3),
|
||||
next(280, 4),
|
||||
next(290, 1),
|
||||
next(340, 8),
|
||||
next(360, 5),
|
||||
next(370, 6),
|
||||
next(390, 7),
|
||||
next(410, 13),
|
||||
next(430, 2),
|
||||
next(450, 9),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
error(600, testError)
|
||||
])
|
||||
let xs = scheduler.createHotObservable([
|
||||
next(110, 7),
|
||||
next(220, 3),
|
||||
next(280, 4),
|
||||
next(290, 1),
|
||||
next(340, 8),
|
||||
next(360, 5),
|
||||
next(370, 6),
|
||||
next(390, 7),
|
||||
next(410, 13),
|
||||
next(430, 2),
|
||||
next(450, 9),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
error(600, testError)
|
||||
])
|
||||
|
||||
var ys: ConnectableObservable<Int>! = nil
|
||||
var subscription: Disposable! = nil
|
||||
var connection: Disposable! = nil
|
||||
let res = scheduler.createObserver(Int)
|
||||
var ys: ConnectableObservable<Int>! = nil
|
||||
var subscription: Disposable! = nil
|
||||
var connection: Disposable! = nil
|
||||
let res = scheduler.createObserver(Int)
|
||||
|
||||
scheduler.scheduleAt(Defaults.created) { ys = xs.replayAll() }
|
||||
scheduler.scheduleAt(450, action: { subscription = ys.subscribe(res) })
|
||||
scheduler.scheduleAt(Defaults.disposed) { subscription.dispose() }
|
||||
scheduler.scheduleAt(Defaults.created) { ys = xs.replayAll() }
|
||||
scheduler.scheduleAt(450, action: { subscription = ys.subscribe(res) })
|
||||
scheduler.scheduleAt(Defaults.disposed) { subscription.dispose() }
|
||||
|
||||
scheduler.scheduleAt(200) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(400) { connection.dispose() }
|
||||
scheduler.scheduleAt(200) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(400) { connection.dispose() }
|
||||
|
||||
scheduler.scheduleAt(500) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(550) { connection.dispose() }
|
||||
scheduler.scheduleAt(500) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(550) { connection.dispose() }
|
||||
|
||||
scheduler.scheduleAt(650) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(800) { connection.dispose() }
|
||||
scheduler.scheduleAt(650) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(800) { connection.dispose() }
|
||||
|
||||
scheduler.start()
|
||||
scheduler.start()
|
||||
|
||||
XCTAssertEqual(res.events, [
|
||||
next(450, 3),
|
||||
next(450, 4),
|
||||
next(450, 1),
|
||||
next(450, 8),
|
||||
next(450, 5),
|
||||
next(450, 6),
|
||||
next(450, 7),
|
||||
next(520, 11),
|
||||
])
|
||||
XCTAssertEqual(res.events, [
|
||||
next(450, 3),
|
||||
next(450, 4),
|
||||
next(450, 1),
|
||||
next(450, 8),
|
||||
next(450, 5),
|
||||
next(450, 6),
|
||||
next(450, 7),
|
||||
next(520, 11),
|
||||
])
|
||||
|
||||
XCTAssertEqual(xs.subscriptions, [
|
||||
Subscription(200, 400),
|
||||
Subscription(500, 550),
|
||||
Subscription(650, 800)
|
||||
])
|
||||
}
|
||||
XCTAssertEqual(xs.subscriptions, [
|
||||
Subscription(200, 400),
|
||||
Subscription(500, 550),
|
||||
Subscription(650, 800)
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
func testReplayAll_Error() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
func testReplayAll_Error() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
|
||||
let xs = scheduler.createHotObservable([
|
||||
next(110, 7),
|
||||
next(220, 3),
|
||||
next(280, 4),
|
||||
next(290, 1),
|
||||
next(340, 8),
|
||||
next(360, 5),
|
||||
next(370, 6),
|
||||
next(390, 7),
|
||||
next(410, 13),
|
||||
next(430, 2),
|
||||
next(450, 9),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
error(600, testError)
|
||||
])
|
||||
let xs = scheduler.createHotObservable([
|
||||
next(110, 7),
|
||||
next(220, 3),
|
||||
next(280, 4),
|
||||
next(290, 1),
|
||||
next(340, 8),
|
||||
next(360, 5),
|
||||
next(370, 6),
|
||||
next(390, 7),
|
||||
next(410, 13),
|
||||
next(430, 2),
|
||||
next(450, 9),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
error(600, testError)
|
||||
])
|
||||
|
||||
var ys: ConnectableObservable<Int>! = nil
|
||||
var subscription: Disposable! = nil
|
||||
var connection: Disposable! = nil
|
||||
let res = scheduler.createObserver(Int)
|
||||
var ys: ConnectableObservable<Int>! = nil
|
||||
var subscription: Disposable! = nil
|
||||
var connection: Disposable! = nil
|
||||
let res = scheduler.createObserver(Int)
|
||||
|
||||
scheduler.scheduleAt(Defaults.created) { ys = xs.replayAll() }
|
||||
scheduler.scheduleAt(450, action: { subscription = ys.subscribe(res) })
|
||||
scheduler.scheduleAt(Defaults.disposed) { subscription.dispose() }
|
||||
scheduler.scheduleAt(Defaults.created) { ys = xs.replayAll() }
|
||||
scheduler.scheduleAt(450, action: { subscription = ys.subscribe(res) })
|
||||
scheduler.scheduleAt(Defaults.disposed) { subscription.dispose() }
|
||||
|
||||
scheduler.scheduleAt(300) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(400) { connection.dispose() }
|
||||
scheduler.scheduleAt(300) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(400) { connection.dispose() }
|
||||
|
||||
scheduler.scheduleAt(500) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(800) { connection.dispose() }
|
||||
scheduler.scheduleAt(500) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(800) { connection.dispose() }
|
||||
|
||||
scheduler.start()
|
||||
scheduler.start()
|
||||
|
||||
XCTAssertEqual(res.events, [
|
||||
next(450, 8),
|
||||
next(450, 5),
|
||||
next(450, 6),
|
||||
next(450, 7),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
error(600, testError),
|
||||
])
|
||||
XCTAssertEqual(res.events, [
|
||||
next(450, 8),
|
||||
next(450, 5),
|
||||
next(450, 6),
|
||||
next(450, 7),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
error(600, testError),
|
||||
])
|
||||
|
||||
XCTAssertEqual(xs.subscriptions, [
|
||||
Subscription(300, 400),
|
||||
Subscription(500, 600),
|
||||
])
|
||||
}
|
||||
XCTAssertEqual(xs.subscriptions, [
|
||||
Subscription(300, 400),
|
||||
Subscription(500, 600),
|
||||
])
|
||||
}
|
||||
|
||||
func testReplayAll_Complete() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
func testReplayAll_Complete() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
|
||||
let xs = scheduler.createHotObservable([
|
||||
next(110, 7),
|
||||
next(220, 3),
|
||||
next(280, 4),
|
||||
next(290, 1),
|
||||
next(340, 8),
|
||||
next(360, 5),
|
||||
next(370, 6),
|
||||
next(390, 7),
|
||||
next(410, 13),
|
||||
next(430, 2),
|
||||
next(450, 9),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
completed(600)
|
||||
])
|
||||
let xs = scheduler.createHotObservable([
|
||||
next(110, 7),
|
||||
next(220, 3),
|
||||
next(280, 4),
|
||||
next(290, 1),
|
||||
next(340, 8),
|
||||
next(360, 5),
|
||||
next(370, 6),
|
||||
next(390, 7),
|
||||
next(410, 13),
|
||||
next(430, 2),
|
||||
next(450, 9),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
completed(600)
|
||||
])
|
||||
|
||||
var ys: ConnectableObservable<Int>! = nil
|
||||
var subscription: Disposable! = nil
|
||||
var connection: Disposable! = nil
|
||||
let res = scheduler.createObserver(Int)
|
||||
var ys: ConnectableObservable<Int>! = nil
|
||||
var subscription: Disposable! = nil
|
||||
var connection: Disposable! = nil
|
||||
let res = scheduler.createObserver(Int)
|
||||
|
||||
scheduler.scheduleAt(Defaults.created) { ys = xs.replayAll() }
|
||||
scheduler.scheduleAt(450, action: { subscription = ys.subscribe(res) })
|
||||
scheduler.scheduleAt(Defaults.disposed) { subscription.dispose() }
|
||||
scheduler.scheduleAt(Defaults.created) { ys = xs.replayAll() }
|
||||
scheduler.scheduleAt(450, action: { subscription = ys.subscribe(res) })
|
||||
scheduler.scheduleAt(Defaults.disposed) { subscription.dispose() }
|
||||
|
||||
scheduler.scheduleAt(300) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(400) { connection.dispose() }
|
||||
scheduler.scheduleAt(300) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(400) { connection.dispose() }
|
||||
|
||||
scheduler.scheduleAt(500) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(800) { connection.dispose() }
|
||||
scheduler.scheduleAt(500) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(800) { connection.dispose() }
|
||||
|
||||
scheduler.start()
|
||||
scheduler.start()
|
||||
|
||||
XCTAssertEqual(res.events, [
|
||||
next(450, 8),
|
||||
next(450, 5),
|
||||
next(450, 6),
|
||||
next(450, 7),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
completed(600)
|
||||
])
|
||||
XCTAssertEqual(res.events, [
|
||||
next(450, 8),
|
||||
next(450, 5),
|
||||
next(450, 6),
|
||||
next(450, 7),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
completed(600)
|
||||
])
|
||||
|
||||
XCTAssertEqual(xs.subscriptions, [
|
||||
Subscription(300, 400),
|
||||
Subscription(500, 600),
|
||||
])
|
||||
}
|
||||
XCTAssertEqual(xs.subscriptions, [
|
||||
Subscription(300, 400),
|
||||
Subscription(500, 600),
|
||||
])
|
||||
}
|
||||
|
||||
func testReplayAll_Dispose() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
func testReplayAll_Dispose() {
|
||||
let scheduler = TestScheduler(initialClock: 0)
|
||||
|
||||
let xs = scheduler.createHotObservable([
|
||||
next(110, 7),
|
||||
next(220, 3),
|
||||
next(280, 4),
|
||||
next(290, 1),
|
||||
next(340, 8),
|
||||
next(360, 5),
|
||||
next(370, 6),
|
||||
next(390, 7),
|
||||
next(410, 13),
|
||||
next(430, 2),
|
||||
next(450, 9),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
completed(600)
|
||||
])
|
||||
let xs = scheduler.createHotObservable([
|
||||
next(110, 7),
|
||||
next(220, 3),
|
||||
next(280, 4),
|
||||
next(290, 1),
|
||||
next(340, 8),
|
||||
next(360, 5),
|
||||
next(370, 6),
|
||||
next(390, 7),
|
||||
next(410, 13),
|
||||
next(430, 2),
|
||||
next(450, 9),
|
||||
next(520, 11),
|
||||
next(560, 20),
|
||||
completed(600)
|
||||
])
|
||||
|
||||
var ys: ConnectableObservable<Int>! = nil
|
||||
var subscription: Disposable! = nil
|
||||
var connection: Disposable! = nil
|
||||
let res = scheduler.createObserver(Int)
|
||||
var ys: ConnectableObservable<Int>! = nil
|
||||
var subscription: Disposable! = nil
|
||||
var connection: Disposable! = nil
|
||||
let res = scheduler.createObserver(Int)
|
||||
|
||||
scheduler.scheduleAt(Defaults.created) { ys = xs.replayAll() }
|
||||
scheduler.scheduleAt(450, action: { subscription = ys.subscribe(res) })
|
||||
scheduler.scheduleAt(475) { subscription.dispose() }
|
||||
scheduler.scheduleAt(Defaults.created) { ys = xs.replayAll() }
|
||||
scheduler.scheduleAt(450, action: { subscription = ys.subscribe(res) })
|
||||
scheduler.scheduleAt(475) { subscription.dispose() }
|
||||
|
||||
scheduler.scheduleAt(250) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(400) { connection.dispose() }
|
||||
scheduler.scheduleAt(250) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(400) { connection.dispose() }
|
||||
|
||||
scheduler.scheduleAt(500) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(550) { connection.dispose() }
|
||||
scheduler.scheduleAt(500) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(550) { connection.dispose() }
|
||||
|
||||
scheduler.scheduleAt(650) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(800) { connection.dispose() }
|
||||
scheduler.scheduleAt(650) { connection = ys.connect() }
|
||||
scheduler.scheduleAt(800) { connection.dispose() }
|
||||
|
||||
scheduler.start()
|
||||
scheduler.start()
|
||||
|
||||
XCTAssertEqual(res.events, [
|
||||
next(450, 4),
|
||||
next(450, 1),
|
||||
next(450, 8),
|
||||
next(450, 5),
|
||||
next(450, 6),
|
||||
next(450, 7),
|
||||
])
|
||||
XCTAssertEqual(res.events, [
|
||||
next(450, 4),
|
||||
next(450, 1),
|
||||
next(450, 8),
|
||||
next(450, 5),
|
||||
next(450, 6),
|
||||
next(450, 7),
|
||||
])
|
||||
|
||||
XCTAssertEqual(xs.subscriptions, [
|
||||
Subscription(250, 400),
|
||||
Subscription(500, 550),
|
||||
Subscription(650, 800),
|
||||
])
|
||||
}
|
||||
XCTAssertEqual(xs.subscriptions, [
|
||||
Subscription(250, 400),
|
||||
Subscription(500, 550),
|
||||
Subscription(650, 800),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user