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)

The app is…


The app we are going to implement is a UIKit implementation of a memory game—a solitaire version. A memory game, also known as Concentration, is a card game where the player must match all the cards, which start reversed, turning up two of them in each turn. If the cards match, they are removed from the table. Otherwise, they are turned down again and the score increases. The goal is to clear the table with the lowest score possible.

In our implementation, we are going to use only standard UIKit components, and to see another way of creating the interface in Xcode, we'll create all of our UI directly in code without using Interface Builder.

Let's start prototyping the screens. Despite this being an educational app, we want it to be a pretty and fun app, so we need at least one option to decide the difficulty, selecting the quantity of cards laid on the table.

The following are the screens we'll implement for the app; the first is for selecting the difficulty—basically selecting...