The course is part of this learning path
This course explores maps and how we can integrate them into our apps. We'll leverage map functions like finding the user location, showing the user's location on the map, and choosing a location on the map to get its coordinates. And in order to do that, we're going to be focusing on an app called Travel Book. We're going to integrate Core Data in this Travel Book as well so that we can re-practice what we have learned in the previous section.
This course is designed for anyone who wants to:
- Learn about iOS development and coding
- Move into a career as an iOS developer
- Master Swift skills
To get the most out of this course, you should have some basic knowledge of iOS.
Hi, within this lecture, we're going to start creating the actual user interface for our Travel Books. So, I'm going to add two text fields in here so that the user can give input for the name of the place and their note or comment of the place, okay? So, we're going to get those name and comment from the user and we're going to display them in the annotation that we have been creating so far. So, let's go to Main.storyboard and as you can see, the map is stretched all the way to the edges. I'm going to make this one a little bit shorter so we can place the text fields on above of the map. So, let's call for a Text Field, drag and drop to here, and let's zoom in a little bit so that we can see it better. So, let's make this a little bit bigger too and put it in the center of this View Controller, okay? So once more, let's go to Placeholder and say name, not name. Name, yeah, this one and copy and paste this with command C and command V. Next thing will be not name but comment or you can just say something like note as well. So, this is where the user will give the input of name and comment and we have to make sure that we update the constraints, we give the constraints one more time. So, this text field and map can actually leave them together in a very structured way. So, let's define this text fields into the coding area after we fix this map here. Once you see this orange lines over in the constraints, it means that there is something wrong. It gets updated but you didn't update the constraints, okay? So, in order to overcome this problem, if you see something with an orange, you have to make sure you come over here and say Update Constraint Constants, and it updates these constraints but it doesn't give the constraints to newly added views. So, I'm going to come over here one more time and say Reset to Suggested Constraints, then they will all have constraints as I wanted to be. So, let me open, and View Controller assistant editor over here and we don't have the name text and comment text. So, let me go above and in here after my class, let me bring in my nameText, okay? So, this is going to be the nameText, and again, this is going to be my commentText. So, this is commentText. Here you go. I've defined them, I have already defined mapView before. So, if I go to ViewController, I can come over here to annotation title and delete this new annotation and rather I can just come over here and say nameText.text, okay? And I believe we can omit doing this force unwrap thing because it's going to take whatever we want from here. We're not converting this to be an integer or something. So, in the subtitle, we're just going to say commentText.text. So, let's try if this works. It will bring the name input and comment input from the user to the title and subtitle of the annotation. So, first we have to write the input, okay? For name, I'm going to say, Eiffel Tower and for comment, let's say, I love Paris, okay? And then, if I click over here for three seconds and hold, as you can see it says that Eiffel Tower, and if I click on it, we can see the subtitle as well, I love Paris. So, it works. The only thing left to do is just take all of those information from here, including the latitude and longitude, and save them into the Core Data database. And luckily, we have learned how to do that in the previous section. So, I'm going stop here and within the next section, we're going to add a new save button to here, and when we click on that save button, we're going to take all of this information and save them into the database.
Atil is an instructor at Bogazici University, where he graduated back in 2010. He is also co-founder of Academy Club, which provides training, and Pera Games, which operates in the mobile gaming industry.