[MUSIC] All right so now we're finished implementing our HoBshareViewController for the time being. Let's move on to the next part which is to flesh out the MeViewController. So once we have completed doing that we'll be almost ready to go and hit the button to create a new user. So let's get through this class. We're inside of MeViewController, let's start off inside of viewDidLoad. Now when viewDidLoad is a good time to go do anything like set the delegates of any objects that we need to do. We have the username text field, inside of our storyboard and we want to make it so that when the user hits the return button inside of the keyboard, then we go and we do something. In this case we're going to make the keyboard go away and we're going to go make the call to create our user or sign in if we use an existing user name. So, we could set the delegate of the text field in the story board. I found that when you're working in teams and working with source control programs like Git, SVN, or things like this, storyboards are a little bit susceptible to getting accidentally changed when we don't mean them to. So things like delegates are important because they're required to make sure that the text field in this case can respond the events happening, like the Enter button being pressed. So if the delegate gets unset in the storyboard accidentally somehow, then that functionality just stops working all of a sudden. And it can be a little bit of a funky bug to track down. So, I've gotten in the habit of doing those type of things in code. So, we'll just say username.delegate = self. Now we're going to get a complaint and that's because this class does not conform to the UITextFiield delegate, as the error here says. So we just need to come up here to our class declaration and say we conform to UITextField delegate, and that error will go away. All right, next we want to respond to the location manager getting an update on our current location. So, we can set the latitude and longitude in our UI here on the MeViewController. All right, so let's do that. When we create a user also, we can optionally pass in our latitude and longitude so the user gets created with a location. And this allows you to be seen on the map by others as soon as you select some hobbies for yourself. If we didn't do this or if that's handled by us on the server. If you don't pass in your latitude and longitude, or if you don't have permission to get your lat long. Or if the core location framework somehow just failed to get your lat long and you can't send the lat long in, we'll still create the user for you but no one will be able to see you. No other user will be able to see you, on the map until you actually go look for other users on the map. That is another place on the server side that we have made sure that your location will be updated in the data base. All right, so let's now go and override the location manager's delegate so we can update our lat and long labels in our UI. So here we say override function of the locationManager didUpdateLocations. And it's complaining because this class doesn't import MapKit. So it can't recognize what CL location manager is. It says he's an undeclared type, CL location manager. So we'll come up here and we'll say import MapKit. And that error should go away. Now all we do is we want to make sure that we call super's implementation, which we wrote. because our super, again, is HobbyshareViewController, which we made. We want to make sure it calls super's implementation so that we get its behavior, which sets the currentLocation property for us. So if we go quickly take a peek at that, which I can do by hitting CMD+clicking that function, it'll take me to the declaration, take me to the definition of that function. Then we can see when we get an update on our location then we set our current location. Okay, now that we have our current location, we can say latitudelabel.text equals, the string, latitude, plus space so that it looks nice, easy readable english. And then we use string interpolation to say current location.coordinate.latitude and same thing for longitude. All right, so now we have listened to the locationManager's updates inside of the MeViewController so that we can update the MeViewController's UI. [MUSIC]