Style Choices

This book contains a lot of code. We have attempted to make that code and the designs behind it exemplary. We have done our best to follow the idioms of the community, but at times we have wandered from what you might see in Apple’s sample code or code you might find in other books. In particular, you should know up front that we nearly always start a project with the simplest template project: the single view application. When your app works, you will know it is because of your efforts – not because of behavior built into the template.

Typographical conventions

To make this book easier to read, certain items appear in certain fonts. Classes, types, methods, and functions appear in a bold, fixed-width font. Classes and types start with capital letters, and methods and functions start with lowercase letters. For example, In the loadView() method of the RexViewController class, create a constant of type String.

Variables, constants, and filenames appear in a fixed-width font but are not bold. So you will see, In ViewController.swift, add a variable named fido and initialize it to "Rufus".

Application names, menu choices, and button names appear in a sans serif font. For example, Open Xcode and select New Project... from the File menu. Select Single View Application and then click Next.

All code blocks are in a fixed-width font. Code that you need to type in is bold; code that you need to delete is struck through. For example, in the following code, you would delete the line import Foundation and type in the two lines beginning @IBOutlet. The other lines are already in the code and are included to let you know where to add the new lines.

import Foundation
import UIKit

class ViewController: UIViewController {

    @IBOutlet var questionLabel: UILabel!
    @IBOutlet var answerLabel: UILabel!

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

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