title: RxSwift: Completing observable sequence of unknown length
body: <h2>Problem</h2>
  <p>I am trying to load all of the data my application needs before using. Once I have all of the data I want to emit one event back to my subscription in my controller with either a success or failure status.</p>
  <p>I am struggling to come up with a way to send an onComplete status on my observable chain so I can use <code>toArray()</code>. Maybe there's a way or just a better approach that I have not thought of.</p>
  <h2>Loading Workflow</h2>
  <p>Basically I have three different services: version, champion, and skin.</p>
  <p>I retrieve the latest version and get all of the champions for that version. Then I download all of the images for each skin the champion has.</p>
  <h2>Observable Chain</h2>
  <p>My observable chain in my LoadingViewModel is something like this:</p>
  <pre><code>return versionService.getLatest().flatMap({ (version: VersionData) in
      return championService.getChampions(forVersion: version)
  }).flatMap({ (champions: [Champion]) -&gt; Observable&lt;Champion&gt; in
      // Go through champions and update total skin count
      // emit each champion
  }).flatMap({ (champion: Champion) -&gt; Observable&lt;Skin&gt; in
      return skinService.getSkin(forChampion: champion)
  }).toArray() // Doesn't work since I don't send complete
  .flatMap({ (result: [Skin]) -&gt; Observable&lt;LoadingViewModelResult&gt; in
      return Observable.just(LoadingViewModelResult.success)
  })
  </code></pre>
  <p>If I don't have the toArray() there then I emit a <code>LoadingViewModelResult.success</code> for each skin which floods my view controller with an abundance of unwanted successful results.</p>
  <h3>What I've Tried</h3>
  <p>I attempted to use <code>.take(count)</code> where I passed in the skin count but since it is initialized to 0 the chain will instantly take 0 and return.</p>