@tundsdev

⚠ The crash at 9:41 is a known issue & has a workaround also by calling modelContext.save() after the deletion of an item

@marcaupont9145

Solid tutorial and great explanations!! 💪🏾💪🏾

@mkhasson97

Nice video, could you perhaps complete the serie and add many to many relationships too? For example let's say insert sub-todo or I mean list into this list, I will really appreciate that. Thank you so much ❤

@SiamakAshrafi

Thanks. Very helpful.

@jayelevy

One additional comment on this and I’m reluctant to share as I’m grateful for what you do! 

Having said that, the coding for this is confusing if you are following these videos in sequence. I completed the first video and then moved on to this. I assumed I could simply continue with the code base as we left at the end of the last video. Wrong assumption. I kept finding pieces of code that were either missing or changed from the first video. Finally realized during the segment when you added the save function that I’m missing a bunch of code. I need to scrap and start over using the git samples for this video. I think this could be explained better. I feel it is a logical progression to move from one video to the next while continuing the same project. 

I hope that makes sense.

@michanierebinski1423

A great follow up

@nileshjdarji

super awesome video. Love it.

@abhishekthapliyal7933

This was really helpful, I was about to bang my head into a wall after the worst relationships examples given in WWDC23. Thanks a ton

@Echaront

In Xcode 15.4, I am encountering errors at 7:05. The error reads: "Struct 'ViewBuilder' requires that 'EmptyTableRowContent<V>' conform to 'View'" and Static method 'buildExpression' requires that 'TextField<Text>' conform to 'TableRowContent'. It would be great if you could update the app using Xcode 15.4 for iOS 17.

@bobgilmore3224

As of Xcode 15 beta... 4? 5?, the @relationship macro requires a deleteRule tag, i.e., at 5:01, you need...

@Relationship(deleteRule: .nullify, inverse: \Category.items)

(I just noticed that this is mentioned in the comment regarding the crash at 9:41, but I wasn't even looking at that that since I was seeing problems at 5:01.)

@edfrazier

I tried to change the code a bit to extract the actual toDoCell from the contentView into its own view.   Everything works fine except when i delete a category  the  content view doesn't refresh and remove the category like it does in the original code.  Can this not be done like that?

@jayelevy

Yet another great set of videos! Thank you for what you do.

I am getting an error “Type ‘Schema.Relationship.Option’ has no member ‘nullify’” in the Item model definition on the @Relationship line (code copied directly from your git). I’m wondering if this is a beta bug? Though, I’ve searched and see no reference to this. I’m stuck.

@ChristopherDisdero

Thanks for another great tutorial!

Despite taking your advice and adding the code to set category.items = empty array and set title = empty string when adding a category, I'm still crashing when deleting a newly added category.  The problem seems to be because we are trying to access the title property of a category item that may have already been removed due to the ForEach loop?

Any ideas?

@mrchumley

Thanks for the video! Brilliant tutorial, but is there something missing just before 8:10? I couldn't see where you added the new buttons to the main view?

@akbar.n

Hello Brother, 
I have one Question ❓
I want to provide an icon & color at the time of creating todo.
For that i had created antother view which had all SFsymbols, which is presented in sheet from where I can select the icon & that icon should be selected on the create todo view. But i m not able to do that.
I way I was able to achive that result was buy create a model for Icon, same as you did for category. But that will use extra resources on the app, because I had created the relationship for Icon with TODO. Not is not approprate.
Because we have all icon in sheet & from that sheet we just want that which icon was selected & should add that icon name String into todo.
We cant append icon into todo because we have not still created new todo.
Home View → Create Todo View → Icon Sheet → Create Todo View
If I have 10 to 20 icon I can make array in the Create Todo View & that will work. I can do that. But I cant pass selected icon from Icon Sheet to Create Todo View.
Can you make a Video 🎞 in which we can you can add icon & color on create category or create todo view.
And categories should also not be on create todo view. If they are with the page we are able to select. But if we move it to another sheet we are not able to select it from there. So please also extract category selection from another sheet. In real apps user has lot of categories.
Video Explaination : https://youtu.be/LQeDWEQf23E
Blog Link : https://noteplan.co/n/2D6DF362-6B45-4908-959C-106205FD4B99

@cloftis130

Great video Tunds. I think the crash you are experiencing may be tied to the new autosave feature implemented with SwiftData. I can consistently get my code to crash by deleting after an insert. To solve this, after the code to perform an insert:    

.insert(task) or .insert(category)

Place an explicit call to the modelContext to save inside a do...catch:

do {
                try modelContext.save()
            } catch  {
                fatalError("Fatal error saving in function/class \(error), \(error.localizedDescription)")
            } 

I know it's not ideal, but I can't get the app to crash anymore. Maybe Apple will fix this in future betas.

@Ride8715

Do you mind explaining the property wrappers? All of these new ones are throwing me for a loop? @Bindable vs @Query is the thing that is catching me off guard. So you create the model on the class with @Model but you link it with @Query? If you want to change something is that when @Bindable comes into play?

Yes that helps! Thank you. Also real credit to you to respond to comments so quickly.

@josephestrada4222

My version of the button.

 // START - New ToDo button
                VStack {
                    Spacer() // Push content to the right
                    // New ToDo button
                    Button(action: {
                        showCreate.toggle()
                    }) {
                        HStack {
                            Image(systemName: "plus.circle.fill")
                                .foregroundColor(.blue) // Icon color
                            
                            Text("New ToDo")
                                .foregroundColor(.blue) // Text color
                        }
                        .padding(.vertical, 10)
                        .padding(.horizontal)
                        .background(Color.white) // Button's background color
                        .cornerRadius(20) // Pill shape
                        .shadow(color: .gray, radius: 2, x: 0, y: 2) // Shadow for depth
                    }
                    .padding(.trailing, 180) // To match the floating button's right padding
                    .padding(.bottom, 20) // To match the floating button's bottom padding
                }

@DavidM979

Github repo is missing from description

@tundsdev

First person to spot the mistake in the intro wins nothing