Adding a Header view

Our Explore has a header, and we need to pass data over to it. To do that, we need to create a header class for it: 

  1. Right-click on the Explore folder and select New File.
  2. Inside the Choose a template for your new file screen, select iOS at the top. Then, select Cocoa Touch Class. Hit Next after.
  3. In the options screen that appears, add the following:

        New file:

  1. Click Next and then Create.
  2. Add the following to this file:
import UIKit
class ExploreHeaderView: UICollectionReusableView {
@IBOutlet weak var lblLocation:UILabel!
}
  1. Next, open the Explore.storyboard file and under the Identity inspector in the Utilities panel, update the Class to ExploreHeaderView.

Now, let's work on passing data from a location to explore and display the selected location in our header.