title: RxSwift - Queue observables of different type from Singleton
body: <p>I have a Singleton class (actually it's going to do web-scraping, but simplified here) with some public available functions. The functions all return a <code>Single&lt;T&gt;</code> but of different types.</p>
  
  <p>It could look like this:</p>
  
  <pre><code>class Singleton {
      static let shared = Singleton()
      private init() { }
  
      func doSomethingInt() -&gt; Single&lt;Int&gt; {
          return Single.just(1)
              .delay(3, scheduler: MainScheduler.instance)
      }
  
      func doSomethingString() -&gt; Single&lt;String&gt; {
          return Single.just("Wow")
              .delay(3, scheduler: MainScheduler.instance)
      }
  }
  </code></pre>
  
  <p>When someone calls <code>Singleton.shared.doSomthingInt()</code>, the function should be placed on a queue, not executing until it's passed through the queue. The next observable in the queue should not start executing before everything before it has completed. Ideally <code>Singleton</code> would have a function which would delay the execution of every functions that is passed onto it. Something like this:</p>
  
  <pre><code>private func placeInQueue&lt;T: Any&gt;(operation: Single&lt;T&gt;) -&gt; Single&lt;T&gt; {
      // place in some magic shared queue
      return operation
  }
  </code></pre>
  
  <p>And then I could just chain this function in the beginning of the functions that should be placed in the queue, like this:</p>
  
  <pre><code>func doSomethingString() -&gt; Single&lt;String&gt; {
      let operation = Single.just("Wow")
          .delay(3, scheduler: MainScheduler.instance)
      return placeInQueue(operation)
  }
  </code></pre>
  
  <p>I feel like this should be possible with a <code>concat</code> operation somehow, but I havn't been able to solve it yet. </p>
  
  <p><strong>Any clues?</strong></p>