Leanpub Header

Skip to main content

Learn Swift Programming by Examples

Learn and master programming with Swift step by step in a practical and fun way. 

The author is letting you choose the price you pay for this book!

Pick Your Price...
PDF
EPUB
WEB
214
Pages
31,766Words
About

About

About the Book

On December 8, 2013, US President Barack Obama "asked every American to give it a shot to learn to code" (watch it here), kicking off the Hour of Code campaign for Computer Science Education Week 2013. "Learning these skills isn't just important for your future, it's important for our country's future," President Obama said.

The message is clear: coding (aka. programming) is an important skill for this Information Age, and many will agree.  Some might wonder: there are many "how to program" books, why another one? 

A typical how-to-program book will go through the programming concepts, syntax and followed by demonstrations with simple examples. I have read dozens of them (for different programming languages) and taught this way at universities. It was not an effective approach. It is more like a teacher dumping knowledge upon students. There is no better way than writing real programs for real exercises. In this book,  I have chosen the exercises that are very simple to understand, besides teaching values, they are useful and fun to do. 

Share this book

Categories

Price

Pick Your Price...

Minimum price

$8.00

$15.00

You pay

$15.00

Author earns

$12.00
$

All prices are in US $. You can pay in US $ or in your local currency when you check out.

EU customers: prices exclude VAT, which is added during checkout.

...Or Buy With Credits!

Number of credits (Minimum 1)

1
The author will earn $12.00 from your purchase!
You can get credits monthly with a Reader Membership

Author

About the Author

Zhimin Zhan

Zhimin Zhan is the founder and principal agile testing coach of AgileWay Pty Ltd, Australia. As an advisor and coach, he helps organisations implement test automation using Continuous Testing with open technologies, such as Selenium WebDriver / Appium. Zhimin is the creator of TestWise, the next-generation functional testing tool that supports functional test refactorings, and BuildWise, an international award-winning Continuous Testing Server. Zhimin is a frequent speaker and author of 14 books on software testing and programming. He shares his test automation and CI experience on Substack and Medium.

Contents

Table of Contents

Preface

  1. What is unique about this book?
  2. Who should read this book
  3. How to read this book
  4. Send me feedback

1.Introduction

  1. 1.1Xcode
  2. 1.2Swift Playgrounds in Xcode
  3. 1.3Swift Projects in Xcode
  4. 1.4Swift Tutorials
  5. 1.5Rhythm for working on the exercises
  6. 1.6Common Errors
  7. 1.7Interactive Swift
  8. 1.8Swift evolves

2.Printing Shapes

  1. 2.1Print out Triangle
  2. Working out the solution on your computer
  3. 2.2Print out a half diamond
  4. 2.3Print out diamond shape
  5. 2.4Print big diamond, name your size
  6. 2.5Exercises

3.Quiz Time

  1. 3.1Simple Add Calculator
  2. 3.2Addition Quiz
  3. 3.3Subtraction Quiz
  4. 3.4Number Guessing Game
  5. 3.5Exercises

4.Array and Dictionary

  1. 4.1Sort Children Names
  2. 4.2Get the character from given alphabetical position
  3. 4.3Calculate Average
  4. 4.4What makes 100% in life?
  5. 4.5Exercises

5.Useful Utility Programs

  1. 5.1Fahrenheit to Celsius Converter
  2. 5.2Personal Income Tax Calculator
  3. 5.3Word count
  4. 5.4Generate Lotto Numbers
  5. 5.5Number sorting
  6. 5.6Exercises

6.Fun Math

  1. 6.1Finding Divisors
  2. 6.2Finding the Highest Common Factor
  3. 6.3Finding the Least Common Multiple (LCM)
  4. 6.4Finding Prime Numbers
  5. 6.5Fibonacci sequence
  6. 6.6Consecutive Sums
  7. 6.7Exercises

7.Functions

  1. 7.1Finding the Highest Common Factor (using function)
  2. Refactoring
  3. 7.2Generate Lotto Numbers (using a function)
  4. 7.3Finding the LCM for multiple numbers (using function)

8.File and Network

  1. 8.1Calculate average score
  2. 8.2Count words and lines in a text file
  3. 8.3Mail merge birthday invitation cards
  4. 8.4Rename files
  5. 8.5Currency exchange with live quoting
  6. 8.6Exercises

9.Object Oriented Programming

  1. 9.1Calculator (Class)
  2. 9.2Age of Teacher and Students
  3. 9.3Calculate Sales Tax
  4. 9.4Library System
  5. 9.5Sunflower vs Zombies Game Simulation
  6. 9.6Exercises

10.Classic Puzzles

  1. 10.1Google Labs Aptitude Test
  2. 10.2Fibonacci and HCF (Recursion)
  3. 10.3Calculate Compound Interest
  4. 10.4Farmer Crosses River Puzzle
  5. 10.5Cryptic Math Equation (Backtracking)
  6. 10.6More Puzzle Exercises

11.Mac OS X App - iSpeak

  1. 11.1Create Xcode Cocoa Project
  2. 11.2Design UI in XIB
  3. 11.3Connect button action
  4. 11.4Connect text field outlet
  5. 11.5Add code to speak the text
  6. 11.6Run the app
  7. 11.7Distribute the app

12.Build iOS App - iCurrency

  1. 12.1Design
  2. 12.2Create Xcode iOS project
  3. 12.3Xcode Storyboards and Interface Builder
  4. 12.4Link UI to Controller
  5. 12.5Add Code Logic
  6. 12.6Convert currencies
  7. 12.7Add Image Assets
  8. 12.8Add app icon
  9. 12.9Optimize
  10. 12.10Distribute to your iPhone

Appendix 1 Swift in Nutshell

Appendix 2 Solutions

  1. Chapter 2
  2. Chapter 3
  3. Chapter 4
  4. Chapter 5
  5. Chapter 6
  6. Chapter 7
  7. Chapter 8
  8. Chapter 9
  9. Chapter 10
  10. Chapter 11
  11. Chapter 12

Resources

  1. Online resources
  2. Books
  3. Software

Contributor

About the Contributors

Courtney Zhan

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub