title: ObservedObject inside ObservableObject not refreshing View
body: <p>I'm trying to display an activity indicator when performing an async request.
  What I did is creating an ActivityTracker object that will track life cycle of a publisher.
  This ActivityTracker is an ObservableObject and will be stored in the view model which also is an ObservableObject.</p>
  
  <p>It seems that this kind of setup isn't refreshing the View. Here's my code:</p>
  
  <pre><code>struct ContentView: View {
      @ObservedObject var viewModel = ContentViewModel()
  
      var body: some View {
          VStack(spacing: 16) {
              Text("Counter: \(viewModel.tracker.count)\nPerforming: \(viewModel.tracker.isPerformingActivity ? "true" : "false")")
  
              Button(action: {
                  _ = request().trackActivity(self.viewModel.tracker).sink { }
              }) {
                  Text("Request")
              }
          }
      }
  }
  
  class ContentViewModel: ObservableObject {
      @Published var tracker = Publishers.ActivityTracker()
  }
  
  private func request() -&gt; AnyPublisher&lt;Void, Never&gt; {
      return Just(()).delay(for: 2.0, scheduler: RunLoop.main)
          .eraseToAnyPublisher()
  }
  
  extension Publishers {
      final class ActivityTracker: ObservableObject {
          // MARK: Properties
  
          @Published var count: Int = 0
  
          var isPerformingActivity: Bool {
              return count &gt; 0
          }
  
          private var cancellables: [AnyCancellable] = []
          private let counterSubject = CurrentValueSubject&lt;Int, Never&gt;(0)
          private let lock: NSRecursiveLock = .init()
  
          init() {
              counterSubject.removeDuplicates()
                  .receive(on: RunLoop.main)
                  .print()
                  .sink { [weak self] counter in
                      self?.count = counter
                  }
                  .store(in: &amp;cancellables)
          }
  
          // MARK: Private methods
  
          fileprivate func trackActivity&lt;Value, Error: Swift.Error&gt;(
              ofPublisher publisher: AnyPublisher&lt;Value, Error&gt;
          ) {
              publisher
                  .receive(on: RunLoop.main)
                  .handleEvents(
                      receiveSubscription: { _ in self.increment() },
                      receiveOutput: nil,
                      receiveCompletion: { _ in self.decrement() },
                      receiveCancel: { self.decrement() },
                      receiveRequest: nil
                  )
                  .print()
                  .sink(receiveCompletion: { _ in }, receiveValue: { _ in })
                  .store(in: &amp;cancellables)
          }
  
          private func increment() {
              lock.lock()
              defer { lock.unlock() }
              counterSubject.value += 1
          }
  
          private func decrement() {
              lock.lock()
              defer { lock.unlock() }
              counterSubject.value -= 1
          }
      }
  }
  
  extension AnyPublisher {
      func trackActivity(_ activityTracker: Publishers.ActivityTracker) -&gt; AnyPublisher {
          activityTracker.trackActivity(ofPublisher: self)
          return self
      }
  }
  </code></pre>
  
  <p>I also tried to declare my ActivityTracker as <code>@Published</code> but same result, my text is not updated.
  Note that storing the activity tracker directly in the view will work but this is not what I'm looking for.</p>
  
  <p>Did I miss something here ?</p>