title: RxSwift filter Variable array
body: <p>Hi I am trying to get an understanding of the RxSwift library to write better, functional code.</p>
  
  <p>Currently I am stuck at a very basic problem. Lets say I got this variables of type <code>Variable&lt;[CiteModel?]&gt;</code>:</p>
  
  <pre><code>var allCites: Variable&lt;[CiteModel?]&gt; = Variable([])
  var shownCites: Variable&lt;[CiteModel?]&gt; = Variable([])
  </code></pre>
  
  <p>Now I want to filter all cites from <code>allCites</code> array which contain a specific text and add them to <code>shownCites</code>.</p>
  
  <p>This is what I have tried but it does not compile because inside my filter block <code>$0</code> is <code>[CiteModel?]</code> <strong>not</strong> <code>CiteModel?</code> what I would expect. Could you explain to me what I did wrong ?</p>
  
  <pre><code>private func filterCitesByQuery(query: String) {
      self.shownCites = self.allCites.asObservable().filter {
          $0?.cite.containsString(query)
      }
  }
  </code></pre>
  
  <p><strong>Error</strong> when executing the above code:</p>
  
  <pre><code>Cannot assign value of type 'Observable&lt;[CiteModel?]&gt;' (aka 'Observable&lt;Array&lt;Optional&lt;CiteModel&gt;&gt;&gt;') to type 'Variable&lt;[CiteModel?]&gt;' (aka 'Variable&lt;Array&lt;Optional&lt;CiteModel&gt;&gt;&gt;')
  </code></pre>