Building Our App Structure in Storyboard

In the previous chapter, we created our Tab Bar Controller. In this chapter, we will be creating other View Controllers that we need in our app. Our goal for the end of this chapter is to be able to navigate through the app with the least code required.

The following will be covered in this chapter:

  • Collection View
  • Outlets
  • Modals

Before we begin setting up our Collection View Controller, you will need to add two files, ExploreViewController and RestaurantViewController, which you'd have downloaded from Packt's website or GitHub. By combining these files and then a bit of code, we will be able to focus on the design of our app.

Later in the book, we will delete these files, and create them ourselves. But, for this chapter, let's add these two files into our project:

  1. Open the assets project folder that you downloaded from Packt's website or GitHub. Open Chapter_08 and drag the two files in the folder into your project in the Navigator panel:
  1. When you drop the folder, you will get the following message:
  1. Make sure you have both Copy items if needed and Create groups selected, then hit Finish.
  2. Add code to these new files, which will allow us to dismiss modals that we will create later in this chapter. A modal is a container that opens on top of the current content showing in an app and allows you to take more action without opening up all of the information on the viewed screen.

    Let's add the code to enable us to dismiss modals.  Open the ExploreViewController.swift file and, under where it says // Add Unwind here at the bottom of the file, add the following code:

@IBAction func unwindLocationCancel(segue:UIStoryboardSegue) {} 

If we look at our app design, which we reviewed earlier in this book, in our first tab, the Explore tab, we show a grid of food cuisines as well as a list of locations. First, we will set up our grid.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.154.103