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

Core Data - New, skeleton project doesn't build

Forums > SwiftUI

Hi people,

I've downloaded Xcode B2 today and created a new SwiftUI/UIKit AppDelegate project.

The problem is, it has build errors out of the box! Is this normal with XCB2? Or SwiftUI 2? Or am I missing something?

The main error in both ContentView.swift and (I think, SceneDelegate.swift) is: Circular dependency between modules 'CoreData' and 'SwiftUI'

Also, AppDelegate.swift has, on the line "Import CoreData", the warning: File 'AppDelegate.swift' is part of module 'CoreData'; ignoring import

I've never used Core Data before and this is a fairly discouraging start. Any help much appreciated. Thanks.

3      

Update: I have just created a 2nd identical project ... and it builds perfectly!

Mystified. Forget I ever said anything!

3      

I'm having issues with XCode 12 beta 2 on Mac BS. I couldn't get CoreData to load on the Bookworm project

I took the above idea and created a fresh project called SUICodeDataTest, below is the console log which you get when you launch the app.

2020-07-15 09:33:03.286962+0100 SUICoreDataTest[24127:2858836] libMobileGestalt MobileGestaltCache.c:38: No persisted cache on this platform. 2020-07-15 09:33:03.306082+0100 SUICoreDataTest[24127:2857686] [error] error: No NSEntityDescriptions in any model claim the NSManagedObject subclass 'Student' so +entity is confused. Have you loaded your NSManagedObjectModel yet ? CoreData: error: No NSEntityDescriptions in any model claim the NSManagedObject subclass 'Student' so +entity is confused. Have you loaded your NSManagedObjectModel yet ? 2020-07-15 09:33:03.306329+0100 SUICoreDataTest[24127:2857686] [error] error: +[Student entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass CoreData: error: +[Student entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass 2020-07-15 09:33:03.361270+0100 SUICoreDataTest[24127:2857686] [SwiftUI] Context in environment is not connected to a persistent store coordinator: <NSManagedObjectContext: 0x600000e94700>

3      

Bookworm Project Tut 3/10 - using Xcode 11.6, MacOS 10.15.6 - two significant errors right out of the starting blocks:

Entity Student successfully created with 2 attributes, but:-

@FetchRequest(entity: Student.entity(), sortDescriptors: []) var students: FetchedResults<Student> generates

Use of undeclared type 'Student' error in ContentView.swift and

Type of expression is ambiguous without more context error in SceneDelegate.swift

SO & Google aren't very enlightning on these. Anybody have any idea, please.

Much obliged, Bruckner

3      

Hacking with Swift is sponsored by Superwall

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

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.