NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

project 11 on xcode 12.2

Forums > 100 Days of SwiftUI

@pwkm  

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

1      

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.

1      

@pwkm  

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?

1      

@pwkm  

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

1      

Hacking with Swift is sponsored by Play

SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!

Click to learn more about Play!

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.