[MUSIC]
>> So this is Raif Brockhaus again, so we are working on writing the iOS application
and I'm doing the second part here right now.
So in the first part of the application we wrote a sample application which allows us
to create a shopping list, it's a simple iPhone application.
In the interface, interface builder with auto-layout features and
we created an array for list some items to represents the model, right?
So we created a dedicated model class.
And we were then able to have the ViewController handle the logic so
that when we entered values.
The data would be entered into the model and
the list view would re-draw the model, right?
So the one part which is standing out or
missing still is the ability to write the file of the data into the file system.
All right and so a couple of things need to happen for that right now.
So I go back into the Xcode environment for that.
And I have my application project open here.
And so what I need to do is I need to write a couple of functions.
So I explained already that the iPhone application is running in a sand box.
Right? So every single mobile application on
the iPhone has its own sand box.
Has its own dedicated area where data can be stored.
Right?
And so we want to access a file in that sand box.
Right? So we need to get
access to a list of directories that exists on the phone.
And then inside there we need to get actually the access to a path
to a file where we want to store our data.
To do that we actually take our model class which is our ShoppingList here.
And inside our ShoppingList we add a couple of additional data items.
So first thing which we do is we create a private variable.
Right, and so, a constant and
file URL of type NSURL, URL.
So we have an NSURL and this NSURL we need to initialize for something, right?
So, what we do here is,
inside that code actually,
we let our document's directory
URLs = to the NFS file.