Right, so so far, we've built our authentic authentication screen, but we're not we don't have a
way of actually showing that to the end user.
So we want to show this auth view controller.
How do we go about it?
Well, what we're going to do is open up our view controller and I'm going to copy and paste some code
that I've got in the premade app.
And what we're going to do is grab the authentication from Firebase.
So if I look at my code over here, we're going to import Firebase Auth.
Like, so and that should give us access to the authentication, so this off is a firebase feature is
going to grab the current off object authentication object and it's going to look for the current user.
If that user is nil, then we are going to grab the view controller from the storyboard.
So this is how we access the storyboard.
We access self-taught storyboard.
And then we say, I want you to make the view controller and I want you to grab the one with this identifier
so we don't actually have that plugged in right now.
So let's go to our main storyboard and give that identifier to this auth view controller.
So here we go.
The storyboard I.D., I believe this is.
And that on pressing enter hit command is to save it.
So that's over on the top, right?
We've put in the Earth view controller.
Now, this shouldn't crash because that is a potential place where you could crash.
What are we going to do?
We're going to get the navigation controller that we currently have and we're going to present what
we the orfeu controller, except you know what the problem is, right?
If we look at our storyboard, what's missing?
There is no navigation controller.
There is only a view controller.
That's the initial entry point.
So we are going to drop in a NAV controller like that.
We are going to remove this other view controller because we don't need it anymore.
So if you just tap the bar at the top or tap the controller, I hate this.
Sometimes if you press backspace, it works or command backspace.
But in this particular case, it won't go away.
Can you believe that?
Anyway, I'll just leave it sitting there for now, what we're going to do is tap the nav control and
the navigation control and we're going to make that the primary initial view controller.
So over on the right is initial view controller is selected.
So that's going to go into the table view and off it goes and does its thing.
OK.
So this route view controller, I'm just going to what am I going to do here?
What I'm going to have to do is implement a table view controller.
So this actually loads because watch what happens if I press play on this.
I think we're going to get some kind of crash potentially.
I mean, I've promised you a crash, and now if I don't give you one, you're going to be disappointed,
right?
But that is working, OK?
It is working because it's using a standard UI table view controller for this table view.
So we have a slight problem here.
What we have here is a table view controller and what we actually want is still the table view.
But we need to have a and if I look at the built project, we need to have a box that allows us to type
our message.
Now, if you have a table view controller, that's all you have on that screen is a table view.
What we have to do is convert this screen to a regular view controller that implements everything a
table view requires.
OK, so what I'm going to do is go back to our project.
And if you follow along with this, what I'm going to do is remove the root view controller.
At least I'm going to try and remove the root view controller.
So let's go over here and try it.
There we go.
It's gone.
And now I'm going to just put in a plain view controller.
Actually, I don't need to I can use our old one content so I can just bring this up here.
Now we need to connect them.
So control click from the NAV controller to the View controller and we are going to have a manual.
No, not a manual Segway.
We're going to have relationship Segway route view controller.
OK, so now that is the route.
If I click the view controller itself and then at the top.
Right.
Just make sure that we have that view controller selected.
Now everything should be fine.
OK, so we've got rid of the table view for now.
We will come back to that when we need to create it.
OK, so let's go back to our view controller.
We have this function we just set up to raise the Earth View controller and now, of course, we need
to call it check the current user.
So let's play that in the iPod Touch.
Seventh gen.
There it is.
Is that building?
Yes, it is building 66 tasks I don't understand.
There weren't that many, and I hopefully won't get a crash, but if we do, we'll be able to fix it,
obviously.
Oh, yes, there is a crash here, so we have an uncaught exception.
What does this say?
This class is not cleverly cutting, applying for the key email address input.
Interesting error.
I'm not sure what that is.
So if we scroll down to the log file, uncaught exception.
Unknown key.
Is that something to do with let's stop it running, so it said something about email address and the
key is if we tap that box and go over to the properties on the right.
That's very, very interesting.
I'm not sure what it's playing at, so I'm going to go look at my finished project here and this is
a good tip for you if you're ever in this situation, is to go look at your old projects and see what
you actually did in those particular old projects.
So I'm going to look at the overview controller because that's where we have the issue to do.
There it is.
And where are our buttons, I mean, functions are all good, that's fine.
Let's go to the story board and let's go to the e-mail address, what do we have here?
We have the content type email address and no keyboard type.
Perhaps it's something to do with the idea of the controller.
I don't know.
Let's have a look.
See.
So Northview controller.
We have the story board I.
D perhaps we should click you storyboarded on the right side there.
Let's play that one again and see what kind of errors that's going to throw at us while still waiting
for it to load.
This is a great app, self-control.
If you browse social media, watch YouTube too much, you can block yourself on your Mac for a little
while as long as you set it for and you absolutely cannot access them even if you reboot.
So it's really good at keeping you focused.
And it's unknown, key exception you, I view controller, this class is not key value coding compliant
for the key email address input.
Now, this is a very interesting area.
I've never seen one like this before.
I'm going to go away and figure it out and then I'll let you know.
What a pain it was, this really obscure bug that was making that error for me.
I'll show you the solution.
You probably won't have this error, though, if you select the top bar of your view controller and
then you go over to the class inspector where you've selected orfeu controller down below that.
This should be clicked inherit module from Target, OK, or you select the module in that drop down
menu.
That was why we were getting that very strange error.
Now, of course, when I hit play, we're going to see exactly what we should see, which is it checks
for the authentication.
There is no user logged in, so it presents what we expect it to present.
Now, there are a couple of things wrong with this screen, as you can see, because I can hold it and
move it up and down.
And, of course, it disappears.
We can't bring it back up.
But because of that action that forgot password is a little bit too low, if you ask me.
So what I'm going to do is increase that to about 30.
Um.
Zero, yes, or minus 10, we get shifted up a little bit now, OK?
And then also I'm going to select email address and password and I'm just going to change their backgrounds
to white because a green background doesn't look that great, does it?
So there's the view background.
Do we have an item background?
No.
So we'll go to the view background and we'll just use white, OK, and then make sure because I did
change some stuff to see what's going on here.
Keyboard type and email address will have keyboard type email for that one too.
And now we're going to hit play on that and it should look somewhat better.
And there we have it, so now if I go to email address, it doesn't show the keyboard it did last time,
of course, when I wasn't recording the simulator can be a little bit weird like that.
It just stops showing things on occasion so we can go to Eyo, maybe keyboard toggle software, keyboards,
we can hit Command K and it will show us and you'll notice the email address keyboard has an app there
and it gives clicks just like real iOS.
And if we go to password you'll notice just the app disappears.
Right.
And the password doesn't asterisk.
So I guess that's something we have to change now.
How do we do that?
Let's go over to password.
We have content type password.
I was pretty sure I knew where this was smart, quote, smart dashes.
A secure text entry, they would go right at the bottom, you just toggle that on and now when we hit
play, we should get that secure entry with the asterisks.
So in we go, and you don't know what I'm pressing because those little dots appear right.
So I think we'll end that one there.