
Learn how to code in swift!
Get from zero to hero in less than a month
Write your first 1000 lines of swift code
Learn the most loved programming language
Get automated feedback from our exercise platform


Reviews
“Read by over 100,000 people, We ❤ Swift is hands down one of the best resources for people who have no programming experience and want to learn programming or how to make an App.”
– NerdOrGeek.com
“Designed for people with no programming experience, these text-based tutorials take you from zero to hero when it comes to coding in Swift.”
– Udacity
“Before you know it, you will have spent hours playing with the exercise platform. It’s very addictive and I highly recommend it for anyone wanting to learn or brush up their Swift skills.” – Darrell Nicholas in
iOS Learning Weekly #16
Build a strong foundationof coding skills
“I just finished the last exercise! Man, what a workout! Thanks for giving me the chance to write so much code in swift. I now feel like I have a smattering of capability (and intensely aware of how much more command of the language I need to have).
When I started, I had not written a single line of code in Swift. So I feel like I’ve come a long way. Great challenges. Now I feel like I can dip into iOS and try and make some headway there!”
– Darcy P.
“For those who don’t know Andrei, this is going to be a life changer. Andrei is my Swift programming tutor and in just working together for a few short months, we’re already preparing to launch my first app into the iTunes store. He’s incredibly knowledgeable, sharp as a tack, patient, and understanding of the fundamentals required to build an app from scratch. Excited to spread the Swift love. :)” – Alice H.
Write your first 1000 lines of code

Learn to code in the most loved programming language

Learn one concept at a time

Get automated feedback from our exercise platform

About the book
After Swift was released we knew that a lot of people will want to make apps with it. We wanted to make an iOS course but we kept on hitting the same wall – there was no resource that will teach people enough programming to be able to make apps. We decided to make that resource – and more than everything – make it available for everyone.The book was designed using a principle named Cascading Information Theory, which is used in games. It gives the reader the minimum possible snippets of information to gain the appropriate level of understanding at each point during the book.
This collection of exercises is intended for people with little or no experience with programming. They introduce basic programming concepts one by one. We estimate that it will take about one month of practice to solve every exercise. Most exercises have hints that should help you solve them. If you get stuck on a problem, read the solution and try to understand it – if you don’t, feel free to ask for help in a comment!
To validate these exercises we worked closely with people who have no programming experience. Our goal is to make sure that we can create a solid foundation for someone who is starting out.
One of our students had absolutely no programming experience and was never good at math. After a month of practice with Swift and these exercises he can now read and write code by himself and is diving headfirst into iOS programming.
Each chapter has a bit of theory mostly in the form of code examples and about ten exercises.
To complement the book we made an exercise platform that helps you solve the exercises from the book. It gives you feedback by analysing and running your code.
Chapters
Online Exercise Platform
Subscribe now and get full access to our online exercise platform + the PDF and ePub versions of the book!

+

Book Only
PDF, ePub and mobi versions of the book.

Exercise Platform

The Exercise Platform complements the book by giving feedback to the student, checking for common mistakes and testing out his source code.
Interactively learn the fundamentals of programming through 100+ exercises. Each exercise from the book is accompanied by a custom made playground that can evaluate your solution. Playgrounds make writing Swift code incredibly simple and fun. Type a line of code and get instant feedback. Our custom built playgrounds include problem statements, hints, examples and testing.

Get helpful feedback on your solutions. Check if your solutions are correct directly from the playground. Our exercise platform analyzes your solutions and tells you exactly what’s wrong.

When Swift and Playgrounds where announced we realised that a lot of people will want to learn to make apps. The book published by Apple is intended for people who already know programming and the language used in it is a bit too technical for beginners. We wanted to step in and help the community grow. We didn’t want to charge for the book because then we would have reached less people. We are counting on the support of the community for this project.
Anyone who wants to learn to code in order to make apps. You can’t start directly with iOS if you can’t read or write code. This book will teach you the basics of programming in Swift and give you challenges to help you along the way.
Anyone who wants to understand how computers work: programming is much more than making apps – understanding how computers work opens many doors.
Learning to code is hard. You need to practice a lot and create a habit out of it. The exercises from the book are designed to help you through the first month of coding. Teaching you concepts one by one and reinforcing them with practice.
We hired someone to learn programming from the book while writing it. He spent about 2-3 hours a day coding and solving exercises from the book. In about a month he went through almost all the exercises from the book (there where about 80 then).
We updated the hints and the theory according to the feedback we received from people who used the book to learn programming or teach others.
We estimate that someone who spends that amount of time with the current version of the book will be able to solve all the exercises.
We tried to simplify the basic concepts of programming as much as possible. Although some parts of the book are a bit technical (like the Tuples chapter) most of the content can be easily assimilated by someone who has no experience with programming.
While not mandatory we do encourage you to use the app in order to solve the exercises from the book. The application gives you real time feedback on what you are doing just like a teacher would. It will test you code and give you hints. The app will also help you keep track of your progress and motivate you to keep pushing until you finish the exercises from the book.
How does the app evaluate my solutions?
For each exercise we have a list of tests that your code has to pass in order to be considered correct.
Before running the tests the platform checks for possible errors by analyzing your code.
The platform tries to detect and inform you of the following mistakes you can make:
- Incorrect Output: The output of your program does not match with the expected one
- Typos: You acicdentally mistyped the name of a variable or function
- Missing variables: You did not declare some of the variables you were asked to declare
- Expected values: After running the code some variables did not have the expected value
- Missing functions: You did not declare some of the functions you were asked to declare
- Incorrect function definition: You defined a function but it’s signature is incorrect
- Runtime errors: Your code crashes on some input data – you’ll see the input that caused the crash
- Missing Enums: The code does not contain an
enum
you were asked to declare - Non recursive functions: You were asked to implement a recursive function but your function is not recursive
- Missing function calls: You were asked to use certain functions to solve the problem but you never used them
Check out the recently updated demo app that includes the first two chapters.
The simple answer is no. The book does not teach you anything about iOS or how apps work. But if you plan on making apps you will have to learn programming before that. Learning to code in the same time you learn to make apps will be more difficult and that will increase the odds of you giving up. Take some time and learn the basic of programming before you start learning iOS.
No – the exercise platform is already integrated in the online version of the book.
Do you offer discounts for bulk purchases or schools?
Yes! Please contact us
Is the book and app updated to swift 3?
Yes! Have fun learning swift!
You can tell other people about the book and share it on facebook or twitter!
Great stuff! Keep going!
Thanks! All the chapters should be published until X-mas
Hi when can i expect the full version of your app to be available?
We are on track with our development. We plan on releasing a beta version of the app by mid March. The app should be available on our site starting April.
Hey, you are a gem. The details, ideas and knowledge you are sharing on your site, I cannot even begin to Thank You all enough. Thank you a whole lot for going through all of this.
Thank you for your kind words!

Stay tuned for the rest of the book and more
Thanks for doing this Andrei – great work!
I’ve just finished working through all the ‘strings’ problems and looking forward to doing ‘arrays’, but there is nothing after strings!!
Do you plan to continue with this?
Hello Peter! I’m glad you’ve made it so far. I should post the Arrays chapter today and the rest during next week. We are going to announce a surprise at the beginning of the year
Stay tuned!
Hey I’m trying to get my cousin into programming and I already sent him this website! He’s going to work through all the exercises, thank you for this great content! Do you have anything for Java/Android? Any books we can buy?
Unfortunately no Java/Android content. I’m happy you like the exercises, I hope they will help your cousin
Do you have a newsletter we can subscribe to? If so, please add me.
Just did
Awesome! Much thanks!
I tried doing the exercises but the second one of secondsInAYear I was unable to complete even though I did what it said.
// secondsInAYear
var seconds: Int
var minutes: Int
var hours: Int
var days: Int
var secondsInAYear: Int
seconds = 60
minutes = 60
hours = 24
days = 365
secondsInAYear = (seconds * minutes * hours * days)
and it wouldn’t let me pass….. Is there a variation in the syntax for your app? If so could I suggest that possibly adding in some variation or multiple answers could be helpful for the logic that lets you pass the current challenge.
Thanks!
The demo version uses regular expressions to read the user defined variables. It does not work for variables that have a defined type (ex “var secondsInAYear: Int”) but works for variables with inferred type (“var secondsInAYear = (seconds * minutes * hours * days)”). The new version uses the swift compiler to determine that and it works for all cases.
Where is the download available for the above mentioned book? Is that available for free?
No download – you can read the book on the site.
Hi, what your doing is great! I am currently taking the swift course on TreeHouse but there is just not enough practices to do! Where do I download this book of yours?
The pdf version is now yet available.
Oh, were can I read this then?
we highlighted the chapter on the page
– hope that helps you find them
Thanks for taking this approach. I would love to get a t-shirt and get access to the larger demo.
Quick question,
I’m receiving compilation errors and missing declaration warnings when submitting my code, but receiving a “correct submission” notice after 2 or so minutes.
Perhaps it has something to do with the timing on the bottom right of the playground?
the app sends a save command to the playground in order to read the code from it. you might need to save before submitting in some cases.
Hey,
Thank you for this wonderful contribution and the work you have put into it.
Great resource and it addressing a gap in the swift learning community. Nice stuff!!
I tried running the demo, but it asks me to upgrade Xcode, even though I have Xcode 6.3.1 (and Xcode 7 beta) installed. Is there any way to bypass the check?
No. We are going to update the demo soon.
Hey, I went through the first chapter. Liked the Demo app a lot. You are missing exercise 1.11 from the book in the app. Bought the epub. I am pretty new to programming. I taught myself a bit of html and css and went through an MIT Open Courseware class on Python several years ago, I plan on working through your book and would be happy to test more of the chapters in the app as they are available. Thanks guys.
We are working hard on launching the app
– should be out by the end of the week
Awesome!
In the new app, I clicked on achievements before there were any to see the screen and the screen was completely blank with no way to get back, I couldn’t even quit Exercise Platform. I had to Force Quit. Other than that, I am enjoying the app. I like your sense of humor. Great job!
Hi, I bought the Excercise Platform and I want to know if there’s some place where I can check for the solutions for 4.10 ,4.11, 4.12.
It will be great to have a chapter on Optionals, I think it’s one of the key features in swift.
Thanks and great job.
Found it..
You can find solution in the book
Hi! Great stuff. Do you have a more application development oriented program? For programmers who already know a lot of the syntax, do you have an exercise library focused on building basic applications/games?
We are working on a series that teaches core iOS concepts – about one is posted each week – stay tuned!
Hey, I’ve been reading the chapters, each link. I see you are selling a book, does it go more into detail then the chapter links on your site?
I am also interested in the exercise platform but i also see there are exercise’s at the end of each chapter in the links posted on the site, does the platform give more explanation to the answer?
basically i would like to know what difference is their to except from purchasing the book and platform vs what is given already on your site.
thanks
The demo platform only has the first two chapters. The pdf/epub/mobi book also has extra explanations – not just the code that solves the exercise.
We give away a lot of content for free because that’s how we can help more people – over 1 million have read our articles so far.
If you buy our products you encourage us to do more awesome stuff! A lot people who buy our book/app do it for this reason – to support us
If you are not satisfied with our app/book you can get a full refund! Nobody asked for one yet.
Now if i buy the app, what about future updates? will the updates be free?
Yes! Free updates
Will you be updating the website copy of the book to fully reflect Swift 2? Still refers to println in the code examples.
yes. The book will be updated in a few days.
By far the best learning content I have ever read to learn Swift! It beats all video courses and other books. I love how it explains the syntax of Swift very well. The best part of this book are the exercises at the end of each chapter. Not only do the exercises help you learn the syntax of Swift, but it also teaches you the logic to solve complex situations using code. I recommend Swift Programming from Scratch to everyone wanting to learn Swift. Thank you
My computer won’t let me open the app, saying it’s from an unidentified developer. Is there a way to get around this?
We made a tutorial
-> https://www.weheartswift.com/how-to-open-the-exercise-platform/
If I buy the exercise platform, does it also come with the book?
yes. And if you pre-order the iOS Spellbook you get both the swift from scratch book and exercise platform as a bonus.
Will you be updating this for Swift 3?
yes!
When will the exercise platform be updated for swift 3?
In a few days. Still working on the update. Sorry for the delay!
I am quite excited about the update for Swift 3. In fact, I preordered the iOS book and already got the Swift book and the exercice app, but I am refraining myself to freshly start with the version 3 of the language. ^^
Hi Andrei, any word on the Swift 3 update for the book and the training app?
The online version has been updated. Currently deploying the update. Shouldn’t take more than a few hours now
Hey everyone,
I wanted to try your Demo to see if I like it and maybe purchase afterwards.
I could open the app but how can I star the exercises. If i Click in Chapter 1 i.e. on Sum nothing happens.
Maybe you can contact me via my email adress.
Thank you, Uwe
You have to move the app in the Applications folder.
Thanks, works perfectly.
let sum = 16 // a + b
let diff = 4 // a – b
// your code here
var a = 10
var b = 6
___________
Is there something wrong with my code lol? it won’t take it.
yes – you used your brain to do the math instead of the computer.
a
is(sum + diff) / 2
andb
issum - a
. this will work for all cases not just for sum = 16 and diff = 4.