UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Solved Day 58 - problems adding a new entity to core data

Forums > 100 Days of SwiftUI

@CJ  

I am trying to work through the Core Data technical project (days 57-59) but have got very confused by the jumping from on thing to another and am wondering if I missing soemthing as I am getting error messages each time the entity is changed. In the tutorial Paul keeps adding different entities but when I add more than one to core data it doesn't recognise the new one and when I write out the fetch request it says 'not found in scope'. I have tried forcing save but I am wondering if you can't actually have two entities in the same core data model or if you have to change something elsewhere. I already had to create a second project after he changed the 'movie' entity to 'wizard' as I could not get that to work at all. Are we supposed to create a new project for each entity or delete the old one? He doesn't mention that we do but clearly I am doing something wrong as it is not working. If anyone could shed any light here, it would be appreciated.

Thanks

2      

At times xcode cannot recognize it immediately, but after rebuild (cmd + B) it starts recognizing.

2      

@CJ  

Thanks for your reply - I have tried but when I press command + b, it says 'failed to build.' I get an error message also in the CoreDataProjectApp file saying 'Generic parameter 'Content' could not be inferred.' As far as I can see, I have done everthing he has and it worked okay for the Wizard entity but this new entity will not be recognised for some reason.

2      

@Bnerd  

CMD+S to save the CoreData, CMD+shift+K to clean, then CMD+B to build.

2      

@CJ  

Many thanks @Bnerd - it is now working!

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

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.