title: RxSwift extension to Observable where Element is Result<>
body: <p>I have a network request that returns <code>Observable&lt;Result&lt;Data, APIError&gt;&gt;</code> which i map straight into array of Realm Object's so in the end i have <code>Observable&lt;Result&lt;[Model], APIError&gt;&gt;</code>, where <code>Model</code> conforms to <code>Decodable</code> and subclasses <code>Object</code>.</p>
  <p>I would like to write an extension to Observable to filter out <code>APIError</code>'s and emit succesful results
  So i tried to write something like this, but it wouln't work for me:</p>
  <pre><code>extension Observable where Element == Result&lt;[Decodable], APIError&gt; {
   func toSuccesOrEmpty() -&gt; Observable&lt;[Decodable]&gt; {
    return flatMap { (result) -&gt; Observable&lt;[Decodable]&gt; in
     switch result {
      case .success(let data):
       return Observable&lt;[Decodable]&gt;.just(data)
      case .failure:
       return Observable&lt;[Decodable]&gt;.empty()
     }
    }
   }
  }
  </code></pre>
  <p>I'm new to RxSwift and i might miss smth. Also i don't want to use <code>onError</code> when creating this observable since i want to use this error later on</p>