public protocol ControlEventType : ObservableType
1
func asControlEvent() -> ControlEvent<Element>
public struct ControlEvent : ControlEventType
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public typealias Element = PropertyType
let _events: Observable<PropertyType>
public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {
return self._events.subscribe(observer)
}
public func asObservable() -> Observable<Element> {
return self._events
}
public func asControlEvent() -> ControlEvent<Element> {
return self
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
extension ControlEvent {
/// Converts `ControlEvent` to `Driver` trait.
///
/// `ControlEvent` already can't fail, so no special case needs to be handled.
public func asDriver() -> Driver<Element> {
return self.asDriver { _ -> Driver<Element> in
#if DEBUG
rxFatalError("Somehow driver received error from a source that shouldn't fail.")
#else
return Driver.empty()
#endif
}
}
}