So we come again in this lesson we're going to talk about the outlets and what they are.
Outlets are essentially decoding part of our interface elements are the way for us to connect pieces
of the visual elements into our coding interface.
Very similar to what you saw me doing in the previous lesson in this lesson going through all of that
together.
So this one to explode like always I'm going to start a brand new project somebody closed this project
and when I say command shift and and this new project single view application I'm going to call it outlet's
project.
So my out this project all the settings are similar as before.
Language is Objective-C.
And then I have the next and now go to my storyboard main storyboard file the file that you always work
on.
I don't want to add a few different labels so I'm going to say Give me one label here.
This one is the one that is here.
And you might want to do your own version of things.
It doesn't matter that you completely follow me or exactly follow without doing it just that you know
let's have a few different items.
This one has a green background.
I'm going to make another lever on two to copy a label you could just hold the old button and drag it.
So if you hold the alt under right it makes another one and every time you do it it makes a new one.
So I'm going to change the background color for this one.
I'm going to say this one has got a pinkish white.
I'm going to select the one in the middle say that one actually has a maybe a bluish background.
So I've got two the colors green blue and pink.
And I went I have three different labels for each of them so I want each of them to show me something
different as the peron's.
Not in here.
So to do that I'm going to open this little window which is the assistant editor what the assistant
editor does.
It allows me to have more than just one file open here because right now when I click on any of these
files that one gets popped open in my editor window but I want to be able to see two of them essentially
side by side.
So I'm going to go to my age file I'm going to open my assistant editor and the assistant editor.
Now I have to load my other for my storyboard.
So one of them is my story but it doesn't matter whether it is on the one on the left or the one on
the right and then the other side.
And when I go up here and say Give me the h file.
So spend a little time make sure you understand this set up you have a few items in here preferably
all of them off the type label and then open both of them side by side using the assistant editor.
So once you have that we can go over here on Connect them together.
I'm actually going to get myself a little bit more space like this so I know what I'm doing.
So in my dad's age for I'm going to get myself a little bit more space.
I'm going to hold the control button and try get the green one over in here and it tells me you want
to make an outlet and I'm going to say yes call it your e-mail label.
It's a common practice to finish the end of each of the names with that type of that object.
So for instance these guys are labels we call them green labels.
If this was a text field that user had to enter their user name he would call it user name textfield
with ended with the same type of suffix.
That is the type of that object in saying that you don't have to do that.
The one thing you should remember is that you shouldn't start these guys with a numeric value.
They have to be a started with an alphabetical value.
So let's put that another one I'm going to say control from the blue one.
Let's try it in yeah.
And this one.
I'm going to call it Blue Label.
There are a lot of things in yellow such as whether you want to make an outfit or an outfit collection
if you're doing other type of objects it might ask you if you want to make an action out of it.
That is the type of storage is v or not.
It will just cause all of these things in their own due time.
But for now let's just make another one and then I'm going to make the third one.
So this one that I want to control drag it over here and this one is going to be the pink label.
So all three labels are not connected to some sort of IP outlet interface based outlet.
Now between my court and that is of course in my h file.
Now once again what is non-atomic v.
What is property.
We'll talk about these things.
These are primarily about the storage and memory management and threading.
And we will talk about this when the time comes.
For now just learn it like this.
You can check the different properties with different outlets and now you have access to them in your
coding environment.
Now that closed system it's off and on but I've got my dog.
Just a quick review of what they have done.
These are the three lines of code.
Again it doesn't matter how you format it but since it's a programming language you're just getting
used to learning the very basics.
You can't add anything that you like.
It's must follow the certain rules of the programming language.
Let me give you an example.
A programming language is very similar to a human language.
So for instance if I had something saying I was in a bus yesterday that makes all the sense you and
that is because you know I'm using the correct vocabulary and the right drama of the English language.
However if I wrote something such as a home made to day and of blueberries that kind of doesn't make
any sense.
Even though you're using some right terminology is it doesn't really produce a sentence and that is
simply because you have to follow the grammar of the language that you're writing in a very similar
thing applies to programming language and you have to learn all of those.
One step at a time and as we go along and you build on the Von's for Objective-C and then from there
on the move on to sweet thing you've And the vase for swift but whatever you are in here make sure that
you don't get an error.
So you can't just randomly go in here.
I don't know or write something such as my brown label because if you do that you will definitely get
an error that pops and tells you that hey you have written something in here which we don't know what
it is and want to type name y brown label.
So my suggestion is that for the time being.
Even though this isn't the most intuitive way of doing it.
Just follow my code and in a few lessons you will get a much better sense of what you can learn but
you cannot write and what different rules you should follow and then you get to a point that they can
actually teach you more and more about the programming itself.
Because for now most of what we're doing is just to get a sense of how the application gets developed
and basically building your confidence in that.
So in saying that I have three lines of code that green label Blue Label and pink label are being made.
And from there I'm going to go to my God I'm fine.
And again don't worry about anything that's happening in here.
Let's just worry about this one method within these two Carol-Lee brackets.
So this one on that one I'm going to get myself a little with more space between them.
I'm going to go ahead and say Blue Label dot text says are blue and semicolon at the end up as if you
are getting to learn one step at a time.
Almost every line in a programming language needs to be close with a semicolon or in this programming
language in Objective-C unless there is a bracket or panaceas coming up after it.
So keep that in mind that most lines they end up having a semicolon at the end of it and that's essentially
terminating one line of code.
So the score has an hour another one green label dot text x are green and let's say pink one is a pink
pink label dot text it says I am not.
Yes.
All right.
So as you can expect right now in the Lord this application and we run this publication these three
labels in our interface should say that three different things that we ask them to say.
As always I'm using the iPhone 8 now.
And because of that I'm going to set my simulator to be iPhone 8 and then I'm going to run it.
You know what something I'm actually going to do and you might want to do the same as well because the
default view is iPhone 8.
I'm actually going to go to my devices on simulators and I'm actually going to hide iPhone 8 plus.
So my default iPhone will be iPhone 8 whenever I'm developing anything.
So with that in mind let's go ahead and build on Ron once it launches the application we should see
three labels each of them saying something at the wrong time.
I'm green I'm blue not yellow.
Now we pack a lot of stuff in this list and a lot of it doesn't make sense to you just yet and that's
perfectly fine.
This lesson is just simply meant to give you the confidence of knowing what some of these things are
and how do you make outlets How do you connect different items from your interface into your coding
environment.
So if you got that part and if you can make these connections it means you know you're perfectly there
and you know we can move on to the next lesson Don't worry about the specifics of you know what is this
life cycle or the view controller or why are we using it that operation and so on and so forth.
All of these things will cover them in the coming lessons with that in mind.
Let's move on to seeing another type of outlet's.