Fixed it by destroying more my store through the code. Basically right after creating my container in the persistence file I added:
`do{
try container.persistentStoreCoordinator.destroyPersistentStore(at: container.persistentStoreDescriptions.first!.url!, type: .sqlite, options: nil)
}catch{ print(error) }
Works great now. Solved it by asking this question in stackOverflow. Full question and answer here: https://stackoverflow.com/questions/73094220/how-to-fully-remove-macos-xcode-application
Post
Replies
Boosts
Views
Activity
I ended up using the coreData entity and set most controls to the entity's property. This way I could use the ViewContext.hasChanges to determine if I need to ask a user before canceling the form. I had issues with the Toggle and Picker as they wouldn't be set/changed in the edit form but when left the value was updated. I ended up using @BabyJ second post (thanks for the code) to extract a temp variable from the Entity onAppear and set the value onChange. This fixed the controls!
In case anyone has the same issue going to get around it by NOT using the storyboard file. Instead set the Plist Launch Screen background color (skipping image as it's stretched weirdly) and creating a custom LaunchScreen view that the app goes through before ContentView. Since they both have the same background color it merges from the default "launch screen" then my custom one and finally my main app ContentView.
Thanks everyone. With all the examples I got something working :)
Got it working in my code with Gene's answer on this Stack Overflow question (https://stackoverflow.com/questions/57614564/swiftui-use-binding-with-core-data-nsmanagedobject); however, it broke my CloudKit syncing.
I had the same issue. The App Store Xcode doesn't work as Ventura has bypassed it. Since we're using the Beta the warning hasn't upgraded, I'm assuming. After reinstalling several times I realized I needed to download the Xcode Beta (not in the App Store) and it now works.
If anyone is curious the first part of a post (https://www.andrewcbancroft.com/blog/ios-development/data-persistence/getting-started-with-nspersistentcloudkitcontainer/) got me started and then the Apple Documentation - specifically Setting Up Core Data with CloudKit to me the rest of the way. I mostly jumped around the documentation from there (got data loading when I started the app) and then Hacking with Swift got me the rest of the way.
You can set it with .preferredColorScheme(.dark).
I haven’t submitted an app yet and so can’t tell you. That said, I asked about app submission in a lab session at WWDC this year and was told if I was rejected I could ask for call clarification so I’d know the why. I wonder if they could also answer your question then too.
I haven’t watched it yet but was also referred to this video (not sure what it goes over): https://developer.apple.com/videos/play/tech-talks/10885
I've gotten my iPad hooked up so I have two devices to test with (macOS and iPad). That said I'm still curious to know whether I can log into a simulator (either with my own Apple ID or a dummy one - how to create?) so I can test through my computer or try it on other simulated devices I don't own.
Not sure what the persistence file would look like but like @MatKuznik said you'd need a relationship. Remove the binary data recipe from PlannedRecipe. Then add a relationship (called recipe) to PlannedRecipe. In Recipe itself add a relationship to PlannedRecipe (I'll call it plans for now). Both will have to point to each other so switch the third tab to the other one so they point each way. On the far right pane you'll want to direct if it's a one-to-many (one-to-one or many-to-many) relationship by setting either side. I'd image a recipe can be in multiple planned recipes but a planned recipe can only have one plan? Unless your plan consists of multiple (WWDC example with pie crust, filling, and whip cream idea comes to mind) in which case you'd want a "to-many" on either side.
Just to confirm you have an NSSet of objects and you can't turn it into an array, right? Getting an error/warning for Cast from 'NSSet?' to unrelated type '[EntityName]' always fails...
There's a parameter allObjects on, at least, the Core Data relationship NSSet that you can use to convert it to an array. In my case I use it when taken a set of Entities from a relationship. So:
FirstEntityName?.relationshipNameWithNSSet?.allObjects as? [SecondEntityName]
If they NEED a result I sometimes use ?? [SecondEntityName]() to create an empty default array.
Sure. The project itself is called Food Truck.
Documentation with link to download: https://developer.apple.com/documentation/swiftui/food_truck_building_a_swiftui_multiplatform_app
GitHub page: https://github.com/apple/sample-food-truck
And link to all the sample code used in the WWDC 2022 videos here: https://developer.apple.com/sample-code/wwdc/2022/