Core Data template Xcode 12.2

I am trying to understand the Core Data template which comes as default with the latest XCode-beta. I am not sure how to get rid of the list of 10 dates and replace it with my own empty entity?

In Persistence.swift check static var preview starting line 13. Over there the following code segment creates the ten record.

Code Block
for _ in 0..<10 {
    let newItem = Item(context: viewContext)
      newItem.timestamp = Date()
}


You can adapt it to accommodate to your own needs.

Otherwise you have got the option not to use the preview context by simply not using it in ContentView.swiftat the very end of the file.

Code Block
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext)
    }
}

Core Data template Xcode 12.2
 
 
Q