Book Image

Swift iOS Programming for Kids

By : Steffen D. Sommer, Jim Campagno
Book Image

Swift iOS Programming for Kids

By: Steffen D. Sommer, Jim Campagno

Overview of this book

This book starts at the beginning by introducing programming through easy to use examples with the Swift Playgrounds app. Kids are regularly encouraged to explore and play with new concepts to support knowledge acquisition and retention – these newly learned skills can then be used to express their own unique ideas. Children will be shown how to create their first iOS application and build their very own movie night application.
Table of Contents (21 chapters)
Swift iOS Programming for Kids
About the Authors
About the Reviewer
Customer Feedback
Getting Set Up


Swift has risen quickly to be one of the preferred languages among developers and will have a long and fruitful future under the guidance of Apple. Since making the language open source over a year ago, it's become clear that Swift will be a versatile cross-platform language with a wealth of opportunities beyond Apple's ecosystem.

This book will introduce you to programming in a fun and approachable way. We will be building and interacting with fun examples to help you grasp multiple concepts. We will also be building fun iOS applications to help solidify your knowledge of Swift.

What this book covers

Chapter 1, What is Programming?, introduces the Swift programming language.

Chapter 2, Getting Set up, shows you how to install Xcode and introduces you to writing code in a Playground file.

Chapter 3, Say Hello, helps you create your own Playground file and write your first line of code.

Chapter 4Favorite Things, discusses how to store values in variables and constants.

Chapter 5Factories, explains types and introduces the String and int types.

Chapter 6Making Pizza, outlines the problem that functions solve along with creating your own functions.

Chapter 7Toy Bin, covers the array and dictionary types.

Chapter 8Smarter Toy Bin, focuses on the use of loops and if-else statements.

Chapter 9, Make Some Friends, takes you through object-oriented programming and classes. You will create your first instance of a class.

Chapter 10, Pokémon Battle, helps you create your own Pokémon class along with having instances of this class interact with each other.

Chapter 11, Simon Says, introduces Interface Builder and Storyboards, and also helps you create your first application with a user interface.

Chapter 12, Starry Night, showcases the view hierarchy and auto layout. You will be creating an application that has a user interface that scales across multiple screen sizes and that will be able to change its background color at the press of a button.

Chapter 13, Space Pizza Delivery, shows you how to create an iOS application that incorporates everything we’ve learned so far. It also introduces enums, private variables, protocols, delegates, and property observers.

Chapter 14, Movie Night - iOS App, takes you through creating an iOS application that introduces UITableViews and persisting data between the launches of the application.

What you need for this book

You will need the following things for the book:

  • A Mac computer running OS X 10.11.5 or later.

  • The Xcode application, which is available in the Mac App Store for free.

  • An iPhone running iOS 8 or newer if you want to test your application on a device. This is optional.

Who this book is for

Children who are curious about the technology we use in our daily lives and who want to know how it works can use this book to learn about programming and build their first iOS app. No prior programming experience is necessary.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The compiler will expect your variables to be of a certain type (int, string, and so on) and will throw a compile-time error if you try to assign a value of a different type."

A block of code is set as follows:

class Pokemon {
    let name: String
    init(name: String) { = name

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Launch Xcode and navigate to File | New | Project."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at We also have other code bundles from our rich catalog of books and videos available at Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.