(Lunch Card Expansion) Make the "newCard" variable empty after adding card

I just noticed something in the Lunch Card app: when adding another card after adding the first, it autofills all the text fields (newCard variable) with the previous info. For a normal customer, I think that would be pretty annoying to have to delete all the field data and replace it every time.

If you need reference, check out previous expansions of this. Here's the most recent code for CardsView and AddView for version 1.2:
Note: Not really important, but instructions now exist.

Note: I added colors as a variable as well.

Here's Info.swift. It's not too much different but there are now colors:


Answered by OOPer in 658774022

after adding card

  • After cardsInfo.add() in Button action of AddView

or
  • After cards.append(newCard) in add() of Info

Make the "newCard" variable empty 

Assign empty to newCard

It is better for you to make it by yourself.
That is a UI choice.

In such a case, it is nice to have it refilled.
But you could add a button to clear all the fields.

Or propose 2 buttons:
New-prefilled and New

That will be an easy evolution for the demo app.

Did you try to do it ?
Accepted Answer

after adding card

  • After cardsInfo.add() in Button action of AddView

or
  • After cards.append(newCard) in add() of Info

Make the "newCard" variable empty 

Assign empty to newCard

It is better for you to make it by yourself.
It'd probably be after cards.append(newCard) using the add() function in info.

Assign empty to newCard

It is better for you to make it by yourself.

Good idea. Thanks.
(Lunch Card Expansion) Make the "newCard" variable empty after adding card
 
 
Q