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

SOLVED: Project 12 issue

Forums > 100 Days of SwiftUI

I am following new tutorials and reached Day 58, i followed everything according to the tutorial for many-to-one relation of candy and country, but for some reason i am getting all the candies in different sections even for the same country origin. https://github.com/answami99/imagesProject12/blob/main/Pasted%20Graphic%2011.png i tried copying the same exact code and its still same. You can check the code here: https://github.com/answami99/imagesProject12/tree/main/CoreDataDuplicate Also i tried running project12 from the files i downloaded from https://github.com/twostraws/HackingWithSwift, and its output is also same.

2      

You might want to check that you have set up the DataModel.xcdatamodel correctly the problem may lay there.

2      

if i do with or without moc.save() should i expect different outputs. I tried with or without in xcode(12.1 i think) it was same result, but now i updated my xcode(13.1) it is different and getting the correct result now.

2      

Aditya asks:

if i do with or without moc.save() should i expect different outputs.

@twostraws suggested you comment out the moc.save() code to save you time while testing.
Otherwise, you'd have to create a few test records and save. Then quit and restart to verify the records were saved. Then you test the delete code. Again, you would quit and restart to verify the records were deleted.

If you changed font size, or color, or padding, or any other minor changes, you'd grow tired of having to repeat the create / delete records steps. His suggestion was for your testing convenience.

It seems that upgrading to XCode 13.1 solved your other issue! Nice.

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.