Coding the initial view controller

The InitialViewController class will display the possible cities where the user is located. Let's continue with the InitialViewController class and complete its code. To complete this code, we need to think about where we are going to store the received information. We will need two arrays of CityInfo: one is to store every object received from the server and the other is to store the objects that are shown after the user's filter. These arrays must be stored as properties:

    private var cities = [CityInfo]()
    private var citiesDisplayed = [CityInfo]()

At this point, we can complete the didUpdateLocations method, which belongs to the CLLocationManagerDelegate protocol. Now, we can request information of the cities ...

Get Swift 2 Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.