Swift is a new language that's great for creating iOS Apps. With this book, you'll use Swift to develop your own iOS Apps and even upload them to the App store. You'll also learn fundamental programming skills along the way.
Hello Swift! is a how-to guide to programming iOS Apps with the Swift language, written from a kid's perspective. This approachable, well-illustrated, step-by-step guide takes you from very beginning programming concepts through developing complete apps. You'll begin by learning the basics of what an App is and what you need to build one. From there, you'll create your first simple App before learning more about programming with Swift. Along the way, you'll conquer important programming concepts that you can use with other programming languages. By the end of this book you'll have everything you need to dive into the world of iOS App Development.
1. Get ready to build apps with Swift!
1.1. Your "I can do It!" journey begins
1.1.1. The pieces of a good app
1.2. What is programming?
1.2.1. From idea to app
1.3. What is Swift?
1.3.1. What's so special about Swift?
1.3.2. Swift can't do everything
1.4. Time to prep your App-Toolbox!
1.4.1. Gather Hardware
1.4.2. Install Software
1.4.3. Setup Optional Developer Accounts
1.5. Write code and see it work in the Swift Playground
1.5.1. What Is the Playground?
1.5.2. Create a Playground
1.5.3. Play with code in the Playground
1.6. Check your App-Knowledge!
2. Create Your First App
2.1. Hello App!
2.2. What the app does
2.2.1. 1. Create a new project
2.2.2. 2. Choose Project Options
2.2.3. 3. Save Your Project
2.3. The Xcode interface
2.4. Create the Hello World app
2.4.1. Open the main storyboard
2.4.2. Changing the screen size
2.4.3. Drag a label object on the view
2.4.4. Run your app!
2.4.5. Run your app on the simulator
2.4.6. Run your app on your iDevice
2.5. Learn about the UI
2.5.1. What is a UI?
2.5.2. Change text colors
2.5.3. Change the background color of a control
2.5.4. Change the background color of a view
2.5.5. More about controls
2.5.6. Using controls to navigate through screens
2.5.7. Designing good user interfaces
2.6. What you've learned
2.7. Test your App-Knowledge
3. Write Your First Real Swift Program
3.1. Apps store data in variables
3.1.1. What is a variable?
3.1.2. How does an app use and save variables?
3.1.3. What types of variables are there?
3.1.4. How to create variables
3.2. Declaring variables and changing values
3.2.1. Declaring variables
3.2.2. Changing variable values
3.3. Transforming your data
3.3.1. Concatenating data
3.3.2. Converting data
3.4. Math Operation Theater
3.4.1. What is an Operation?
3.4.2. Do basic Math with Swift (+,-,*,/)
3.4.3. Step Up in Math with Swift (square root, power, modulus)
4. I/O Laboratory
4.1. How apps and users interact
4.1.1. How do users get output?
4.2. Users give Apps Input
5. Computers Make Decisions, Too!
5.1. Conditions with the if statement
5.1.1. if this is true, then do something
5.1.2. Use an if statement in an app
5.2. Switch statements
5.2.1. The Mystery of the Entered Number app: use a switch statement!
6. Let computers do repetitive work
6.1. Controlling Repetition
6.1.1. For-In loop statements
6.1.2. While loop statements
6.2. App: How many times?
6.3. Check your app-knowledge
6.4. Hang your Word Upside-Down!
7. Knitting variables into arrays and dictionaries!
7.1. What is an array?
7.1.1. Getting to your data
7.1.2. Altering the Array
7.1.3. Looping Through Arrays
7.1.4. APP10 Number Sorter
7.1.5. Go to the second dimension: Rows and Columns!
7.2. What is a Dictionary?
7.2.1. Creating a dictionary and getting to your data
7.2.2. Altering the Dictionary
7.2.3. Looping Through Data in Dictionaries
7.2.4. APP Friend List
7.3. APPSERCISE Alphabet Unscrambler
8. Reuse your code Clean it with function detergent!
8.1. Reuse & Clean your code with Functions
8.1.1. Simple Functions
8.1.2. Giving info to your reusable code!
8.1.3. Getting Info from your Reusable Code!
8.2. APPSERCISE: Virtual Dice: Never lose your dice again!
8.3. APPSERCISE: Rock Paper Scissors!
8.4. APPSERCISE: Money Denomination
9. Reduce Your Code Use Less, Do More with Class Detergent
9.1. Reduce & Clean your code with Classes
9.1.1. What is a Class?
9.1.2. How do classes reduce code?
9.1.3. Like father, like son: Inheritance!
9.2. Where all can I be (exist)?
9.2.1. What is variable Scope?
10. Reading and writing files
10.1. What is in a file?
10.1.1. What is File Content Managing?
10.1.2. How does it work?
10.1.3. FCM An Example
11. Frameworks bookshelves of classes
11.1. What is a framework?
11.1.1. Creating Swift'o'File
12. SpriteKit Fun Animation Time
12.1. Let’s meetSpriteKit
12.2. How does SpriteKit work?
13. Time to watch your apps on Apple’s Watch
14. Continuing your journey with Swift
Bonus Appendixes Homework Helpers
Appendix A: Check if I am Prime!
Appendix B: Mean Median Detective!
Appendix C: I am Mixed up, make me Improper!
Appendix D: How big is a triangle?
Appendix E: Factoring Factory!
Appendix F: Metric Mania!
- Crystal-clear explanations
- Engaging images and and straightforward examples
- Hands-on lessons
- Exercises that encourage critical thinking
About the reader
While written with a younger audience in mind, this book is for readers of any age with no programming experience who want to enjoy learning to create iOS Apps.
About the author
Tanmay Bakshi began coding at the age of four and had his first App on the iOS App Store by the age of nine. He taught himself Swift when it was still in beta. He's excited about passing on his knowledge to other young and new programmers.
Lynn Beighley is the author of more than a dozen programming and technical books, including the bestsellers Head First SQL and Head First PHP & MySQL.