title: SwiftUI: How to change top-level ContentView @State during preview?
body: <p>I have a top-level MacOS SwiftUI content view where I normally initialize @State for my array of [Frame] to an empty array [].  But when I preview it, I would like to have a sample Frame in it.</p>
  
  <p>Here's minimal code: (Frame is my own struct, Frame.sampleFrame is a static frame for preview use).</p>
  
  <pre><code>struct ContentView: View {
      @State var frames: [Frame] = []
  
      var body: some View {
          VStack {
              FrameSummaryView(frames: self.$frames)
              Text("Placeholder")
          }.frame(maxWidth: .infinity, maxHeight: .infinity)
      }
  }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
      }
  }
  </code></pre>
  
  <p>and here's how I create a constant 1-element array [Frame.sampleFrame] in my FrameSummaryView, if I preview that:</p>
  
  <pre><code>struct FrameSummaryView_Previews: PreviewProvider {
      static var previews: some View {
          FrameSummaryView(frames: .constant([Frame.sampleFrame]))
      }
  }
  </code></pre>
  
  <p>How can I make it so my top level ContentView uses the .constant([Frame.sampleFrame]) [Frame] array when in preview mode?</p>