File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,14 @@ extension ObservableType where Element: EventConvertible {
16
16
- seealso: [materialize operator on reactivex.io](http://reactivex.io/documentation/operators/materialize-dematerialize.html)
17
17
*/
18
18
public func elements( ) -> Observable < Element . Element > {
19
- return filter { $0. event. element != nil }
20
- . map { $0. event. element! }
19
+ return compactMap { $0. event. element }
21
20
}
22
21
23
22
/**
24
23
Returns an observable sequence containing only error elements from its input
25
24
- seealso: [materialize operator on reactivex.io](http://reactivex.io/documentation/operators/materialize-dematerialize.html)
26
25
*/
27
26
public func errors( ) -> Observable < Swift . Error > {
28
- return filter { $0. event. error != nil }
29
- . map { $0. event. error! }
27
+ return compactMap { $0. event. error }
30
28
}
31
29
}
You can’t perform that action at this time.
0 commit comments