Hey everybody what's going on this is callup with slopes dot com.
And in this video we're going to set up our project to have several groups to hold the different files
for our model Leor view layer and controller layer of MBC.
So pull open your X code project that we've been working on and what we're actually going to do is set
up some project folders first.
So go ahead and right click on MVC ify me cap'n and you'll see lots of options.
But we want new group OK go ahead and click on new group and you'll see it'll create a folder within
that folder.
Now I like to go in reverse controller view and model because it's going to put the folder on top of
it.
We can drag them however you want later it just saves time.
So anyway go ahead and call this folder controller.
Then right click on our project folder again click new group make a view folder right click again new
group and a model folder suite.
So now we have a folder for each of the components of model view controller and we already have a view
controller file right here.
Now I'm going to go ahead and drag and drop this into the controller folder so that it's in place and
I don't usually like to do anything with these five that are left.
The app delegate I like to leave out so that it's accessible may not storyboard.
I use all the time so I like to keep that out.
I like to keep the assets folder handy in case I need to drag in things.
Same with the launch screen and the info up the list is is used a lot as well so I like to keep these
accessible for when I am programming.
So now we need to go ahead and I just want to show you very quickly we're just going to kind of poke
around the project and I want to explain a few things to you now in the NBC in theory video that we
watched first in this Target topic we talked about that the model contains data it contains a blueprint
on how to build something.
We learned that the view is like a watch face it displays data from the model and it gets that data
because the view controller controls and shares and modifies and updates all of that information.
So in the main storyboard take a look you can see we have a view controller pretty cool right now if
I click on this it is now selected and if I go over here to a helpful tool called the identity Inspector
I can see the identity of this view controller and as you can see here it is View Controller.
Right.
That coincides with View Controller dot Swift.
If this was to be named something else like how about just controller I can go ahead and rename this
controller as well and the file name does it matter as much as the class name.
You know what just because lets delete this too.
And what I can do now is now that the name has changed I can go back into Main storyboard select my
view controller and actually change my class to be controller as I have now modified it.
So if I press enter it will now say controller which is pretty cool.
So as you can see this swift file goes along with this view controller.
So you're probably wondering wait a minute I can see it.
How come this is a view.
Well the view controller is what is displayed on the screen and it handles the presentation of views.
And now if you look right here within the View Controller we have access to the view and this is the
main view of the application.
Pretty cool so that's the main view.
But what if I wanted to drag on something like a label.
If I were to do that and just drop it here this is now inside the main view.
But the interesting thing is is that deep down a label inherits properties from UI view.
So this in a way is also a view.
So we can go ahead and just get rid of that for now.
We can see the controller here is showing the view it'll present the view when we build the app and
the controller controls everything that happens in the view.
Now the model we're not able to use interface builder by the way that's what this is called.
We're not able to use interface builder to deal with the the model.
We have to do that in code and that makes sense because the model should only contain data and it should
only include instructions on how to construct a certain type of something that you want to construct.
So I just wanted to show you briefly how to set up these groups to organize our project as well as how
it works with Interface Builder with the controller with the view and other various views we can add
on we're going to connect them all up so that they can communicate and talk with one another in another
video but for now this is a pretty good start.
We have set up our project successfully.
We have organized it and we have also sort of seen visually how the controller and view interact.
So in the next video we're actually going to dive into creating our model layer.
OK we saw a controller in this video we saw the view a little bit but we're going to dive into the model
there.
It's always a good starting point to start with the data.
The most fundamental core piece of your app is dealing with data the controller and view presenting
that data.
That's easy stuff.
The model though is always a good foundational starting point.
So we're going to head over to that video now and let's build our model.