Add Recorded Event timeless factory method

This commit is contained in:
beeth0ven 2017-12-26 21:37:35 +08:00 committed by Krunoslav Zaher
parent 0bc7754ea7
commit b924b28ac4

View File

@ -9,6 +9,21 @@
import RxTest
import RxSwift
extension Recorded {
public static func next<T>(_ element: T) -> Recorded<Event<T>> where Value == Event<T> {
return Recorded(time: 0, value: .next(element))
}
public static func completed<T>(_ type: T.Type = T.self) -> Recorded<Event<T>> where Value == Event<T> {
return Recorded(time: 0, value: .completed)
}
public static func error<T>(_ error: Swift.Error, _ type: T.Type = T.self) -> Recorded<Event<T>> where Value == Event<T> {
return Recorded(time: 0, value: .error(error))
}
}
func next<T>(_ value: T) -> Recorded<Event<T>> {
return Recorded(time: 0, value: .next(value))
}