Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 633 Bytes

2020-05-12_preview-with-core-data.md

File metadata and controls

23 lines (17 loc) · 633 Bytes
title createdAt
Preview with Core Data
2020-05-12 21:22:50 UTC

Preview with Core Data

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
        
        let task1 = Task(context: context)
        task1.title = "NewTask"
        
        return HomeView().environment(\.managedObjectContext, context)
    }
}

https://stackoverflow.com/questions/57700304/previewing-contentview-with-coredata

https://stackoverflow.com/questions/57777915/swiftui-preview-canvas-and-core-data