All right.
So here we are.
And we put together a no do list earlier.
So it's just an empty string array that we create at the top here.
Remember it is indeed a has a wrapper state it can change along with the view.
OK.
So let's think about here's a little bit.
This no do list here will have to be populated with items that we add in our text field.
And if you think about it now let's think where are we going to be adding things into our list.
Meaning this list of arrays there.
This list of strings.
Well let's think a little bit about it.
The idea here is that the moment they hit Enter so to answer something it's not until we hit enter in
our keyboard or if you are actually using the application you hit the enter key or button.
Right.
It's not until then that we are going to be adding something don't know to list.
And hopefully that point will also be able to rebuild and added the item inside of our list or table
view right.
So so that brings us back to our text field here and we have these on commit.
So this is the best place to do so.
Right because it is when we commit something hit enter we want something to happen.
So this is the best place for us to add the code that we want.
Well first of all what we want to do well we want to go say South dot no do list.
Notice we just getting the variable no do list.
And what are we gonna do.
We're going to say insert because he'd send Ray there is a method that we can call call insert an insert.
There's two flavors of conservators to insert that he can see here can actually add a collection of
items but we just want to add a new element.
OK so so in this case he may say insert what am I adding.
Well I'm adding whatever we have insider attacks field which we can get it from our self that now do.
So I'm going to say self dot no do notice I'm not taking the binding one I'm taking just this no do.
There we go.
And at what meaning at what index just put in front meaning at zero.
So every time you add something going to put in front of the end in front of the right what we can do
now we're going to say print and I'm going to say added item like this little interpolation there I'm
going to say self finish that when I say self that no do list just to see if there's something in there
the moment we hit Enter let's run this
OK.
So moment of truth I'm going to say first.
No.
Do enter the moment you do that he can says added item first.
No do was added inside of order no do I know do a right.
In fact if I come down here and add another one second one and you notice what happens.
Now our array has changed and we added the next one but the first one that we added goes to the back
because that's what we said here at zero index.
So just put in front of the array.
Whenever we add so we can keep adding here something like this.
And you can see it keeps going.
So this is indeed working but at this point here we want to do what we want to do is we want to be able
to actually add those items inside of our list to add these items when we commit or when we enter to
our lists automatically while we have to go back down here we have a list no.
Although it was an empty one.
We can do that right.
In fact let me go ahead and delete this and do all over again and when it's a list and in this case
he has the data what is it that we're gonna be adding.
Right.
Well we have the data rate I want to say self DOD a no do list.
I need to pass the identify by in this case here.
We are going to use this self as identifier for each item and then I'm going to say item and look at
this.
And say text and at this point here I can just go ahead and add our item instead of our text and voila
save and run notice now.
Our list is empty of course but there's nothing added but look at this.
The woman would say bye cars enter and voila it's adding second Ender third enter fourth enter and they're
being added automatically.
All of these as possible really is because our no do list.
First of all is indeed a state.
So who knows if something happens is going to go ahead and change.
And most importantly also is that you know do the actual item that is tied or bind or bound I think
that's the right way to say it to our text field we'll know exactly what to do as well because it knows
if something changes anywhere.
Anything pertaining to me a no do variable since I'm bound I'll have to also change that automatically
and do whatever I need to do okay.
So here is the most important part.
This is on comet on comet.
We want to go ahead and insert whatever was committed or whatever we ended.
Now our text field into our array.
Right.
And then once that happens because everything is bound over we have this state.
Everything is connected to the variables in our list.
List to requires to have an actual Ray or a data source.
And we go ahead and insert in our text and voila.
So now as you keep adding We are indeed adding to our array.
You keep adding more.
You can delete all of that stuff there and add something else something and you can keep going.
And just like that we have a very simple no do list working here.