title: Cannot preview this file - message send failure for display message to agent
body: <p>Im having an issue using live previews on xcode. The project builds fine and works on a simulator. I have all my environmentobjects connected so I am a bit confused. And yes I also have the EO on the app file itself.</p>
  <p>&quot;Cannot preview in this file - Message send failure for send display message to agent&quot;</p>
  <p>I am using AlertSettingsView in every view located in TabBarView - HomeView, SearchView, ExploreView, and OrdersView. When using the AlertSettings preview provider everything works just fine. But when I try to preview the entire app it no longer works. If I remove the highlighted lines below the code will preview just fine.</p>
  <pre><code>struct AlertSettingsView: View {
      @EnvironmentObject var avm: AlertsViewModel
      private let width: CGFloat = UIScreen.main.bounds.width
      private let height: CGFloat = UIScreen.main.bounds.height
      var body: some View {
          ZStack {
              Color.theme.orange.ignoresSafeArea()
              VStack {
                  ForEach(0..&lt;8) { text in
                      Text(&quot;lakjsdfiojas;dfkljadskl;jfj&quot;)
                  }
              }
          }
          .frame(width: width, height: height/2)
          .animation(.spring())
          .cornerRadius(15)
          .offset(y: avm.settingsViewOffset) &lt;-- This line breaks the preview
      }
  }
  </code></pre>
  <pre><code>class AlertsViewModel: ObservableObject {
      @Published var showAlertsView: Bool = true
      @Published var showSettingsView: Bool = false
      @Published var settingsViewOffset: CGFloat = UIScreen.main.bounds.height/2
  }
  </code></pre>
  <pre><code>struct TabBarView: View {
      @EnvironmentObject var tvm: TradeViewModel
      @State private var selectedTab: Int = 0
      var body: some View {
          ZStack {
              Color.theme.background.ignoresSafeArea()
              VStack(spacing: -4) {
                  ZStack {
                      switch selectedTab {
                      case 0:
                          HomeView()
                      case 1:
                          SearchView()
                      case 2:
                          ExploreView()
                      case 3:
                          OrdersView()
                      default:
                          HomeView()
                      }
                  }
                  Spacer()
                  TabBarButtons(selectedTab: $selectedTab)
              }
              .ignoresSafeArea(.keyboard, edges: .bottom)
              
              HomeMenuView()
          }
          .fullScreenCover(isPresented: $tvm.showTradeView) {
              TradeView()
          }
      }
  }
  
  struct TabBarView_Previews: PreviewProvider {
      @State static var avm = AlertsViewModel()
      @State static var hvm = HomeViewModel()
      @State static var ipvm = InvestorProfileViewModel()
      @State static var apvm = ArtistProfileViewModel()
      @State static var tvm = TradeViewModel()
      static var previews: some View {
          TabBarView()
              .environmentObject(avm)
              .environmentObject(hvm)
              .environmentObject(ipvm)
              .environmentObject(apvm)
              .environmentObject(tvm)
              .preferredColorScheme(.dark)
      }
  }
  </code></pre>