title: RxSwift Wait For Observable to Complete
body: <p>I'm new to rxswift and here's my problem:</p>
  
  <p>Suppose I have observable of actions: Observable.of("do1", "do2", "do3")</p>
  
  <p>Now this observable mapped to function that returns observable:</p>
  
  <pre><code>let actions = Observable.of("do1", "do2", "do3")
  
  func do(action: String) -&gt; Observable&lt;Result&gt; {
         // do something
         // returns observable&lt;Result&gt;
  }
  
  let something = actions.map { action in return do(action) } ??? 
  </code></pre>
  
  <p>How can I wait for do1 to complete first, then execute do2, then do3?</p>
  
  <p>Edit: Basically i want to achieve sequential execution of actions. do3 waits for do2 result, do2 waits for do1 result.</p>
  
  <p>Edit2: I've tried using flatmap and subscribe, but all actions runs in parallel.</p>