Chapter 12 Adding Items to the List--have a warning

l have found the project files for the app at this stage under 14 in the Source Code folder.But when I runned it,Xcode has gived me a Warning:

And in book is like this—Chapter 12: Adding Items to the List

➤ Add a line to the Button’s action: parameter so that the part of body that defines
the button looks like this:

Button(action: {
let newChecklistItem = ChecklistItem(name: self.newItemName)
}) {
HStack {
Image(systemName: “plus.circle.fill”)
Text(“Add new item”)
}
}

so,here is “let” or “var”? Thanks :grin:

When I edit the checklistitem name ,and have this, I don’t know this mean,how can I fix it?Thanks a lot :blush:

image

Hi @sinaqq163 welcome to the forum community! Thank you for providing a screenshot and code. That makes it easier for us to understand your problem. Generally you’ll use a let when you know the variable will not change and you’ll use a var if you know or think the value will change. For the issue with the check list item, could you share a screen shot or let us know what the debugger might say? I am not sure how to go about the bug with the information given above.

Best,
Gina

hi @gdelarosa Gina,thanks very much

I have done it yet , thanks :blush:

1 Like

@sinaqq163 Do you still have issues with this?

@shogunkaramazov

Thank you very much
I have started to try to write a project :blush:

This topic was automatically closed after 166 days. New replies are no longer allowed.