Table view in iOS app

First, let's create a new single view Xcode project with the default language Swift and target OS—iOS. We already know how to do this from previous chapters:

Open the storyboard and add a new table view controller. (Use the Utilities panel and the object library. If you filter the controls, you will find the Table View Controller in no time.) You should see two view controllers on the screen:

Two view controllers on the screen
Use a different scale level so that you can see more scenes at once.

Drag the gray/blue arrow (the one on the left) from the default view controller to the new view controller. This  arrow defines which scene (screen) is the app's initial view controller. You can remove the other view controller, which we won't use.

Before defining the table cells, which should be used to render each item in the table, we need to sort out where the data will come from. For simplicity, the app will use a hardcoded list of countries. Each of them will have one or more cities and exactly one of those cities, will be the capital of that country.

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

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