Okay, so thus far, we have a button with an image of a microphone.
But when I click on it, nothing happens.
So let's change that.
Notice that we are currently in the standard editor.
How do I know that, you ask?
Well, because this button, which is labeled Standard editor, is selected.
The button right next to it is called the Assistant editor.
If I click on it, Xcode continues to show me the storyboard, but in addition to
that, it shows me another file which is logically related to the storyboard.
This file is called ViewController.swift.
Let me slide out the Navigator so we can see this a little bit better.
There.
Now, the way these two are related is that when we click on the record button,
some code will get executed.
And that code will go right here in the ViewController.swift.
By the way, this file,
ViewController.swift, was created by Xcode when we made our project.
Now, I can almost hear some of you say, how are these two files related?
Here's how.
Let me select this phone frame in the storyboard such that there is
a blue outline around it.
And now, if I slide out the utility area and
then click on this little icon right here, which is labeled Identity Inspector,
I can see that this frame is connected to a class called ViewController.
By the way, all of this work was done by Xcode where we actually made our app.
Okay, let me slide out the utility area for a bit.
All right, let's scan the code inside this file, ViewController.swift.
Now, it's okay if you do not understand everything in this file.
For now, I just want to highlight that the name of this file
is the exact same as the name of the class inside the file.
And this class has two functions, viewDidLoad and didReceiveMemoryWarning.
Now, these are functions that allow us to manage or
control certain events with the app.
For instance, if we wanted our app to do something special in case our
app received a memory warning, that code would go right in here.
All right.
Now I'm going to write code that will execute when we hit this button.
I will press and hold Control down on my keyboard, click on the button, and
then drag towards my code.
And once I'm there, I'll let go.
You will be presented with a pop-up that will try and
make a connection between the storyboard and this code.
And because we are trying to do something when we click on this button,
the type of this connection is Action.
Let's call the name of this connection recordAudio.
The type of the button is UIButton.
UI stands for user interface.
Under Event, I will select Touch Up Inside.
What that means is that this event will be triggered when my
finger is within the bounds of the button, and then I'll hit Connect.
All right, I now have a skeleton function which will be called when I
hit the record button.
Let's examine this function.
Its name is recordAudio, which seems about right.
Also, the center of this action, or
the thing that actually triggers this function, is our UI button.
We also see something new, something called IBAction.
IB stands for interface builder, and
this thing tells developers that this is not an ordinary function, but
is instead linked to the storyboard or the interface builder somehow.
Okay, so I want to do two things when this function is called.
The first is that I want to show some text that says, recording in progress.
And then the other thing I want to do is actually record the user's voice.
By the way, when you start to add TODOs in this way,
they start to show up really clearly in this drop-down at the top.
This way, you can easily keep track of the things you need to do.
For now, I'm going to add a print statement to this function and
see if this function is in fact executed when I click on this button.
I'm going to run this project.
Now when I click on the button, I will see the output of
the print statement in the debug area at the bottom of Xcode.
Let me do that one more time.
There it is.
All right, I'm going to go back to my Xcode, slide out the debug area from here,
and the next thing I'm going to do is show some text that reads,
recording in progress.