App runs fine, but preview complains executeFetchRequest:error: A fetch request must have an entity..

I'm migrating my app from Obj-C to Swift. It uses Core Data, and most of the entities are implemented in Obj-C. I just took a stab at converting one of my views to SwiftUI, and it runs correctly, but Preview crashes with

executeFetchRequest:error: A fetch request must have an entity..

I've tried declaring the fetch request both with and without the entity: argument:

	@FetchRequest(entity: NewsItem.entity(), sortDescriptors: [])	var newsItems : FetchedResults<NewsItem>

Hi,

Sorry to hear you are having problems getting previews working. Best next step will be to file a feedback with diagnostics so we can take a look. Great if you could attach a sample project that we can use to reproduce the issue you are hitting.

Steps to generate helpful diagnostics:

  1. Download and install the logging profile on all devices involved. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift
  2. Reproduce the issue
  3. Click the "Diagnostics" button in the error banner in Previews' Canvas area (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  4. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  5. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)
  6. Generate the sysdiagnose(s) and attach those too
App runs fine, but preview complains executeFetchRequest:error: A fetch request must have an entity..
 
 
Q