'ContentView_Previews' is not a member type of error : <p>'ContentView_Previews' does not compile if ContentView references an external object.</p>

<p>If I remove all references to @ObservedObject, preview compiles.</p>

<pre><code>import SwiftUI

struct ContentView: View {

    @ObservedObject var fancyTimer = FancyTimer()

    var body: some View {

    Text("\(fancyTimer.timerValue)")
       .font(.largeTitle)
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

import Foundation
import SwiftUI
import Combine

class FancyTimer: ObservableObject {

    @Published var timerValue: Int = 0

    init() {

        Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) 
        { timer in
           self.timerValue += 1
        }
     }
   }
</code></pre>

<p>Error is: 'ContentView' is not a member type of 'FancyTimer'</p>
