title: RxSwift unwrap optional handy function?
body: <p>Currently I have created a function <code>unwrapOptional</code> to safely unwrap the optional input in the stream.</p>
  
  <pre><code>    func unwrapOptional&lt;T&gt;(x: Optional&lt;T&gt;) -&gt; Observable&lt;T&gt; {
         return x.map(Observable.just) ?? Observable.empty()
      }
  
      let aOpt: String? = "aOpt"
      _ = Observable.of(aOpt).flatMap(unwrapOptional).subscribeNext { x in print(x)}
  
      let aNil: String? = nil
      _ = Observable.of(aNil).flatMap(unwrapOptional).subscribeNext { x in print(x)}
  
      let a: String = "a"
      _ = Observable.of(a).flatMap(unwrapOptional).subscribeNext { x in print(x)}
  
     // output 
      aOpt
      a
  </code></pre>
  
  <p>What I want to archive is to create a handy function instead of using <code>flatMap(unwrapOptional)</code>, for example</p>
  
  <pre><code>Observable.of(a).unwrapOptional()
  </code></pre>
  
  <p>Something I tried to do, but it never compiles...</p>
  
  <pre><code>extension ObservableType {
      func unwrapOptional&lt;O : ObservableConvertibleType&gt;() -&gt; RxSwift.Observable&lt;O.E&gt; {
          return self.flatMap(unwrapOptional)
      }
  }
  </code></pre>