title: Resolve combine future outside of future's closure
body: <p>I'm using <a href="https://developer.apple.com/documentation/combine/future" rel="nofollow noreferrer">Future</a> to create a publisher that returns a single value from outside of the future creation closure. For this, I store the <a href="https://developer.apple.com/documentation/combine/future/promise" rel="nofollow noreferrer">promise</a> property locally:</p>
  <pre><code>return Future&lt;Something, Never&gt; { promise in
     self.somePromise = promise
  }.eraseToAnyPublisher()
  </code></pre>
  <p>Then after some work is finished I resolve the promise:</p>
  <pre><code>self.somePromise(.success(data))
  </code></pre>
  <p>I've searched the documentation and haven't found any references, is this a correct usage or is there a better way to do it?</p>
  <p>To put it more into context, my idea is to have some kind of &quot;broker&quot; class, that returns promises and that at some time in the future will publish a result:</p>
  <pre><code>class FruitBroker {
      
      // MARK: - Private Properties
      private var applePromise: Future&lt;[Apple], Never&gt;.Promise!
      private var orangePromise: Future&lt;[Orange], Never&gt;.Promise!
      
      // MARK: - Methods
      func getApples() -&gt; AnyPublisher&lt;[Apple], Never&gt; {
          return Future&lt;[Apple], Never&gt; { promise in
             self.applePromise = promise
          }.eraseToAnyPublisher()
      }
      
      func getBananas() -&gt; AnyPublisher&lt;[Orange], Never&gt; {
          return Future&lt;[Orange], Never&gt; { promise in
             self.orangePromise = promise
          }.eraseToAnyPublisher()
      }
      
      // MARK: - Private Methods
      private func onHarvestFinished() {
          applePromise(.success(apples))
          orangePromise(.success(oranges))
      }
  }
  </code></pre>