title: How to compose a combine publisher that emits the last-emitted value to its 2nd subscriber
body: <p>I'm trying to compose a publisher, that, when a subsequent subscriber connects to it, emits the last emitted value immediately to that subscriber, and then continues to emit future values to all connected subscribers.</p>
  <p><strong>Q:</strong> Is there a way to do this <strong>without writing a publisher from scratch</strong>, and only by composing built-in publishers? I might be missing something here.</p>
  <p>So, if we had a publisher counting every second:</p>
  <pre><code>let counter = Timer.publish(every: 1, on: .main, in: .common)
                     .autoconnect()
                     .scan(0, { v, _ in v + 1 })
  
  
  let sharedPublisher = // ??? something with counter publisher above
  
  sharedPublisher.sink { print(&quot;A: &quot;, $0 }.store(in: &amp;bag)
  
  // after 2.5 seconds
  sharedPublisher.sink { print(&quot;B: &quot;, $0 }.store(in: &amp;bag)
  </code></pre>
  <p>The output would be:</p>
  <pre><code>A: 1 // at t=1 sec
  A: 2 // at t=2
  B: 2 // at t=2.5
  A: 3 // at t=3
  B: 3 // at t=3
  </code></pre>
  <hr />
  <p>Initially, naively, I thought I could just use a <code>.share</code> and a <code>.buffer</code>:</p>
  <pre><code>let sharedPublisher = counter
                    .share()
                    .buffer(size: 1, prefetch: .byRequest, whenFull: .dropOldest)
  </code></pre>
  <p>but of course, that doesn't work since <code>buffer</code> only buffers if the downstream isn't ready to accept values, which isn't the case here.
  Maybe something with <code>Record</code>/<code>Record.Recording</code>?</p>