Places VC
Start course
3h 18m

In this course, we're going to build a Foursquare Clone using Parse. Parse provides you with a great tool to work in cloud servers and you will learn the advantages and disadvantages that come with it.

Intended Audience

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 add our new  View  Controllers so that we can really see the effects of signing in and signing up the users and so that we can move on to create our foursquare clone. So, let's go to our main.storyboard because we need a new  View  Controller. So, let's open our library and search for  View Controller, okay? We're going to bring in one  View  Controller and we're going to use this  View  Controller as a places  View  Controller in which we display the places that has been saved to the server in a Table  View. So, this is going to be a very basic  View  Controller in which we will only have one Table  View. After this  View  Controller, we're going to have multiple more  View  Controllers as well because we need some other  View  Controllers to choose the image, choose the location, choose the type and the name of the places that we're going to save, and we're going to segue from here to other  View  Controllers later on. So, first thing that comes to my mind is to have a navigation  Controller over here so that we can navigate between this and the other  View Controllers, okay? So, choose this  View  Controller over here and go to your menu to Editor and come into this Embedded and say navigation  Controller. So, you have seen this before. This brings in a navigation bar. And when we do a segue from here to another  View  Controllers, they have automatic back buttons in the left hand side. So, let's do the segue from here to Navigation  Controller. And once we do that, as you can see, it kind of distorts here because it does the segue as a popover segue, and we don't need that, right? And we don't need any Navigation  Controller in the sign-in  View  Controller as well, so we're going to have to change the type of this segue in order to overcome this problem. So, click over here, and rather than push, I'm going to present modularly. And remember if we change this presentation to fullscreen, then we're going to solve this problem. So, here you go. Now, I'm ready to come over here to this segue and give some identifier. So, I'm going to call these toPlacesVC because I'm going to name my new  View  Controller as places  View Controller, okay? And here you go. Let's bring in some views in here. So, open the library and search for Table  View and that's all we're going to need in this  View  Controller anyway. So, let me give some constraints, and we're going to do 000 because we want to stretch out this table all the way to the edges so that it will fill up all the screen. So, that's good. Let's come over here and create a new file so that we can have a Cocoa Touch Class and bind it to our new  View  Controller. So, this is not going to be a Table  View cell, this is going to be something UIViewController and here I'm going to call these PlacesVC and hit 'Next' to place this under my FourSquareClone project folder. So, here you go. If you come over here to main.storyboard, you can connect your  View  Controller from identity inspector to your PlacesVC Cocoa Touch Class so that we can define all the  Views using our assistant editor, and let me bring in my Table View from here and call this Table  View. Yes, now we are ready actually, because that's all we need. And in the places  View  Controller, I want to have a navigation button as well because I need a button to add new places as you have seen in the initial lecture of this section where I have introduced the FourSquareClone that we're going to build. Remember, we had one button on the right hand side, just a plus button allowing us to add a new place. So, remember how we do that. We can call the NavigationController.NavigationBar.topItem, and this gives us the type item of the navigation bar. If you say right bar button item, that's all we need to add a new button. So, we want a button and we want it on the right hand side of the top navigation bar. So, this is going to be a UIBarButtonItem and I'm going to go for this system item and target an action as usual. So, let me close this down. And for system item, I'm going to go for add again and target will be self, of course, and selector, we don't have it. So, let me just say selector and we're going to have to create that selector function. So, this is going to be an @objc func, addNewPlace or addNewButtonclicked, okay? So, now I can come over here and say addButtonClicked and this will be displayed in my navigation bar. So, this is where I will do a segue to my at places  View  Controller. So, let me run this, actually. Do we have to do anything else to test this? No, I don't think so because we have our segue, right? Yes, we have to actually, because in signInClicked and signUpClicked, we're not doing any segue right now, so I'm going to say perform segue, so perform segue. And the identifier will be toPlacesVC and the sender will be nil. And we have to copy and paste this to signUpClicked as well so that we can take people to the places  View  Controller when they sign up. So, we get some kind of error, we have to say self.perfomSegue and we have to say self.performSegue from here. So, let me run this and test to see if we can take the users in by signing them in or signing them up. And let's see if we can see the add button as well. So, let's go for James 123456. Here you go. When I click sign in, now I'm in the places  View  Controller; that's nice. Now I have my add button as well. Once I click it, nothing happens because I haven't written my function yet. And one problem that we have right now, if I open this from scratch, it will ask me for a username and password one more time. And this is not good because nobody will use my app if I ask username and password every time they open the app. So, I have to find a function to remember if the user is logged in or not. So, if the user is logged in, I'm going to take them to the placesVC, if they are not, I'm going to take them to this signInVC. So, that's what we're going to do in the next lecture.


About the Author
Learning Paths

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.

Covered Topics