Book Image

Swift by Example

By : Giordano Scalzo
Book Image

Swift by Example

By: Giordano Scalzo

Overview of this book

Table of Contents (15 chapters)

Building the skeleton

Having defined the requirements, let's start implementing it, splitting the implementation into auto-conclusive phases.

Creating the project

In the same way as we did for the previous apps, we create an empty Single View app, from which we remove the reference to the main storyboard and the ViewController template.

Just for the sake of testing quickly, we create PrettyWeatherViewController, showing a red background:

class PrettyWeatherViewController: UIViewController {
    override func viewDidLoad() {
        view.backgroundColor = UIColor.redColor()

Also, we add the creation of the ViewController in the AppDelegate:

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        let viewController = PrettyWeatherViewController()
        let mainWindow = UIWindow(frame: UIScreen.mainScreen().bounds)
        mainWindow.backgroundColor = UIColor.whiteColor...