Book Image

Swift 2 By Example

By : Giordano Scalzo
Book Image

Swift 2 By Example

By: Giordano Scalzo

Overview of this book

Swift is no longer the unripe language it was when launched by Apple at WWDC14, now it’s a powerful and ready-for-production programming language that has empowered most new released apps. Swift is a user-friendly language with a smooth learning curve; it is safe, robust, and really flexible. Swift 2 is more powerful than ever; it introduces new ways to solve old problems, more robust error handling, and a new programming paradigm that favours composition over inheritance. Swift 2 by Example is a fast-paced, practical guide to help you learn how to develop iOS apps using Swift. Through the development of seven different iOS apps and one server app, you’ll find out how to use either the right feature of the language or the right tool to solve a given problem. We begin by introducing you to the latest features of Swift 2, further kick-starting your app development journey by building a guessing game app, followed by a memory game. It doesn’t end there, with a few more apps in store for you: a to-do list, a beautiful weather app, two games: Flappy Swift and Cube Runner, and finally an ecommerce app to top everything off. By the end of the book, you’ll be able to build well-designed apps, effectively use AutoLayout, develop videogames, and build server apps.
Table of Contents (18 chapters)
Swift 2 By Example
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Free Chapter
1
Welcome to the World of Swift
2
Building a Guess the Number App
Index

The app is…


The most common, and perhaps the simplest, way to learn how to develop an iOS app is by starting with a to-do list, where the user can add tasks, show them, and change their status.

You need to be aware that a generic utility app for iOS must handle the following:

  • Getting data from the user

  • Presenting data obtained from the user

  • Manipulating data

  • Somehow saving data

  • Synchronizing data with a server

Our TodoList app has all of these features except the last one, and it can be considered the prototype of all utility apps. Let's define the specifications of our app. The first, and the most useful, screen must present the list of Todos, as shown in the following screenshot:

Each one in the list of Todos has a description, due date, and category (Family, Personal, Work, and so on), which can be used to filter and catalog tasks. A checkbox indicates whether the corresponding task is done or still open.

The user can perform three different actions: edit, delete, or set a particular Todo task...