title: Mapping Swift Combine Future to another Future
body: <p>I have a method that returns a Future:</p>
  
  <pre><code>func getItem(id: String) -&gt; Future&lt;MediaItem, Error&gt; {
    return Future { promise in
      // alamofire async operation
    }
  }
  </code></pre>
  
  <p>I want to use it in another method and covert <code>MediaItem</code> to <code>NSImage</code>, which is a synchronous operation.  I was hoping to simply do a <code>map</code> or <code>flatMap</code> on the original Future but it creates a long Publisher that I cannot erased to <code>Future&lt;NSImage, Error&gt;</code>.</p>
  
  <pre><code>func getImage(id: String) -&gt; Future&lt;NSImage, Error&gt; {
    return getItem(id).map { mediaItem in
      // some sync operation to convert mediaItem to NSImage
      return convertToNSImage(mediaItem)  // this returns NSImage
    }
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <p><code>Cannot convert return expression of type 'Publishers.Map&lt;Future&lt;MediaItem, Error&gt;, NSImage&gt;' to return type 'Future&lt;NSImage, Error&gt;'</code></p>
  
  <p>I tried using <code>flatMap</code> but with a similar error. I can <code>eraseToAnyPublisher</code> but I think that hides the fact that <code>getImage(id: String</code> returns a Future.</p>
  
  <p>I suppose I can wrap the body of <code>getImage</code> in a future but that doesn't seem as clean as chaining and mapping.  Any suggestions would be welcome.</p>