Encontre seu próximo livro favorito

Torne'se membro hoje e leia gratuitamente por 30 dias.
Swift iOS Programming for Kids

Swift iOS Programming for Kids

Ler amostra

Swift iOS Programming for Kids

436 página
4 horas
Lançado em:
Mar 22, 2017


About This Book
  • Children can express their creativity while learning through interactive Swift Playgrounds
  • Empower children to think critically about problems
  • Learning programming basics can help children gain confidence in problem solving
  • Help children put their imagination into action building their first iOS app
Who This Book Is For

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

Lançado em:
Mar 22, 2017

Sobre o autor

Relacionado a Swift iOS Programming for Kids

Livros relacionados
Artigos relacionados

Amostra do Livro

Swift iOS Programming for Kids - Steffen D. Sommer

Table of Contents

Swift iOS Programming for Kids


About the Authors

About the Reviewer


Why subscribe?

Customer Feedback


What this book covers

What you need for this book

Who this book is for


Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book




1. What is Programming?

The Swift programming language

Why is programming important?

What you will learn from this book


2. Getting Set Up


Downloading Xcode



3. Say Hello

What is a console application?

Setting up our first Xcode playground

Creating the playground

Saving our playground

Removing what is unnecessary

A quick look at the Xcode interface

Creating our program

A quick look at Xcode errors

Xcode and autocompletion


4. Favorite Things

Variables and constants




5. Factories

String and Int



6. Making Pizza

How the iPhone runs our program

A simple program without functions

What is a function?

A function can receive some input

A function can be pure

A function can return something

A look at functions in Swift

Making our own function


7. Toy Bin

Collection types





8. Smarter Toy Bin


 Learning the for-in loop


Learning for-loops and if-statements

Append method

Find the buttercup


9. Making Some Friends


Modeling real-world objects

Modeling a mug

Modeling a person

Our first class

Instance properties

Instance methods

Making objects interact with each other

Adding more classes to the mix


10. Pokémon Battle

Pokémon type

Initializer syntax

Functions and types

Charizard versus pikachu

Hug function


11. Simon Says


Laying out a view

Setting up a new iOS project

Xcode's Interface Builder and storyboards

Simon says

Designing the interface


12. Starry Night

A deep dive into UI in iOS

The view hierarchy

Frames and bounds

Auto Layout

The UIViewController life cycle

Starry Night

Designing the UI

Adding functionality to our interface


13. Space Pizza Delivery

Space Pizza



Switch statement


Type property

Space junk

Pizza service

Property observers

Storyboard and view controller

Hooking everything up

Space junk buttons

Updating the cost


14. Movie Night - iOS App

How to create a list

The data source

The delegate


Our final application: Movie Night

The interface

Displaying items in our list

Dynamically adding items to our list

Deleting items from our list

Persisting our movies

Deploying our application to our iPhone


Swift iOS Programming for Kids

Swift iOS Programming for Kids

Copyright © 2017 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: March 2017

Production reference: 1170317

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street


B32PB, UK.

ISBN 978-1-78712-074-7



About the Authors

Since Swift was announced at WWDC, Steffen D. Sommer has had a passionate interest in the programming language. He's currently working as a lead Vapor developer at a company called Nodes in Copenhagen, where he focuses on developing backend systems using Swift.

In his spare time, he helps organize the local iOS meet up, visits iOS conferences around the world, and explores the different aspects of and use cases for Swift, such as putting Swift on the server and doing functional programming in Swift. You can also find him contributing to open source projects on GitHub or blogging on his personal website.

First, I would like to thank my girlfriend, Mia, for her never-ending feedback and support while I wrote this book. I would also like to thank my friends at IAIF for their input and support throughout the process.

Jim Campagno is an iOS developer and teacher living in New York City. He's currently working as an iOS instructor at the Flatiron School, helping beginners of Swift and iOS become iOS developers.

Jim has a deep desire and high level of creativity that he brings to teaching. He created the Swift online course offered at Flatiron School, which includes in-depth readings along with test-driven labs, challenging the student to write code in Swift. Jim also runs an active YouTube channel, putting out in-depth content and helping students understand everything in iOS and Swift—from the basics to complex topics.

Most importantly, Jim ensures that the content he creates is accessible, fun, and interactive. He enjoys putting together a story behind every topic to make it more enjoyable for the reader.

I would like to thank my roommates (Tom and Matt) for putting up with me while I wrote this book. I would also like to thank Tim Clem, who has inspired me to keep learning. Lastly, I would like to thank Joe Burgess for teaching me how to code.

About the Reviewer

Doug Sparling works as a technical architect and software developer for Andrews McMeel Universal, a publishing and syndication company in Kansas City, MO. At AMU, he uses Go for web services, Python for backend services, Ruby on Rails and WordPress for website development, and Objective-C, Swift, and Java for native iOS and Android development. AMU's sites include www.gocomics.com, www.uexpress.com, www.puzzlesociety.com, and dilbert.com.

He also was the co-author of a Perl book, Instant Perl Modules for McGraw-Hill, and a reviewer for other Packt Publishing books, including jQuery 2.0 Animation Techniques: Beginner's Guide and WordPress Web Application Development. Doug has also played various roles for Manning Publications as reviewer, technical development editor, and proofer, working on books such as Go in Action, The Well-Grounded Rubyist 2nd Edition, iOS Development with Swift, and Programming for Musicians and Digital Artists.


For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.


Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

Fully searchable across every book published by Packt

Copy and paste, print, and bookmark content

On demand and accessible via a web browser

Customer Feedback

Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/Swift-Programming-Kids-Steffen-Sommer/dp/1787120740/.

If you'd like to join our team of regular reviewers, you can e-mail us at customerreviews@packtpub.com. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!


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 4, Favorite Things, discusses how to store values in variables and constants.

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

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

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

Chapter 8, Smarter 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) {

        self.name = 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 feedback@packtpub.com, 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 www.packtpub.com/authors.

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 http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

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

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

Click on Code Downloads & Errata.

Enter the name of the book in the Search box.

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

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

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 https://github.com/PacktPublishing/Swift-iOS-Programming-for-Kids. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. 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 https://www.packtpub.com/sites/default/files/downloads/SwiftiOSProgrammingforKids_ColorImages.pdf.


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 http://www.packtpub.com/submit-errata, 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 https://www.packtpub.com/books/content/supportand 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 copyright@packtpub.com 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,

Você chegou ao final desta amostra. Inscreva-se para ler mais!
Página 1 de 1


O que as pessoas pensam sobre Swift iOS Programming for Kids

0 avaliações / 0 Análises
O que você acha?
Classificação: 0 de 5 estrelas

Avaliações de leitores