title: Passing a class instance into a PreviewProvider in SwiftUI?
body: <p>so in my ContentView, I'm creating a view with:</p>
  
  <pre><code>ViewName(variable: ObservedObjectInstance)
  </code></pre>
  
  <p>where variable is the name of an initialization parameter required for the view; it takes in something of the same type as the ObservedObjectInstance. The ObservedObjectInstance is an @ObservedObject variable that was declared as a struct-level variable. In the ViewName class, I'd like to be able to access ObservedObjectInstance but I'm not sure how. I tried just declaring the following as a struct-level variable:</p>
  
  <pre><code>var variable: ObservedObjectClassType
  </code></pre>
  
  <p>and then in the PreviewProvider, I tried doing the following:</p>
  
  <pre><code>ViewName(variable: variable)
  </code></pre>
  
  <p>but it didn't work. I'm pretty sure the declaration of 'variable' in the ViewName class and the PreviewProvider is what's wrong, but I'm not sure how to fix it. Any help would be greatly appreciated. </p>