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 a skeleton app


Let's start implementing the base structure on top of which we'll implement the entire app.

Implementing an empty app

Let's start creating a new app called Todolist using the Single View Application Xcode template. The app will be in portrait mode only, so you must uncheck Landscape from the allowed device orientations.

Although Apple has improved Interface Builder in Xcode 6, most developers still favor writing the layout in code instead of using Interface Builder. The common reasons, are that, with Interface Builder, it is more difficult to create reusable views, which makes work in a team difficult because of merging of the storyboard files; and in general, it is more difficult to debug a complex layout.

The main reason I prefer layout in code is that it is much easier to have everything under control if I use code. I can group the layout into functions, change the order of the constraints, add variables to them, and so on.

Although this may seem more verbose than creating...