-
Book Overview & Buying
-
Table Of Contents
Swift Cookbook
By :
At this moment, you know how to migrate the model part of an application. However, in real life, we also have to replace the graphical classes. Doing this is not complicated, but this could include a bit full of details.
Continuing with the previous recipe, make a copy of it or just commit the changes you have and let's continue with our migration.
Now, follow these steps to replace the UI classes:
First, create a new file called MainViewController.swift and start importing UIKit:
import UIKit
The next step is to create a class called MainViewController. This class must inherit from UIViewController and implement the UITableViewDataSource and UITableViewDelegate protocols:
class MainViewController:UIViewController,UITableViewDataSource, UITableViewDelegate {Then, add the attributes we had in the previous view controller. Keep the same name you used before:
private var vehicles = [Car]()
@IBOutlet var tableView:UITableView!Next, we need...
Change the font size
Change margin width
Change background colour