LAST CHANCE: Save 50% on all my Swift books and bundles! >>

project 11 on xcode 12.2

Forums > 100 Days of SwiftUI


hello everybodey

I have a problem with project 11. If i try to code this excerise, my xcode generate automatically a file called : persistence.swift. All is based on the initial xcdatamodeld referincing item.

And thus application want compile.

Is their a new version of this learning tutorial for project 11 or am I missing something. How can continue?

Kind regards Peter


Hi Peter,

I'm using Xcode 12.2 on Project 11 and it's working for me. However, I had to make sure I created the project using "UIKit App Delegate" for the Life Cycle in the project options to follow along with the tutorial.



Hello David,

Thanks for the answer. Does that mean, that you does not have file in your project called PersistenceController? I have that file and it's still referencing the Item and itemtimestamp (These are the initial entity and items in the BookWorm.xtcdatamold file).

After modifying my model this file is not updated automatically. And in the excersise their is no reference to this file.

So you don't have a persistent controller?



I just solved it by putting the property

*static var preview: PersistenceController = { ... }() **

In comment and changing the struct ContentView_Previews the line ContentView().environment(.managedObjectContext, PersistenceController.preview.container.viewContext)

to ContentView()

Probably it 's not smart to change the preview, but it works


Hacking with Swift is sponsored by Essential Developer.

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until July 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.