Learn Swift Programming from Scratch

the cover

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


“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.”

“Designed for people with no programming experience, these text-based tutorials take you from zero to hero when it comes to coding in Swift.”

“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 foundation
of 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

one concept
at a time

Get automated feedback
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.

Online Exercise Platform

Subscribe now and get full access to our online exercise platform +  the PDF and ePub versions of the book!

cover final small  
cover final small

Book Only

PDF, ePub and mobi versions of the book.


cover final small
Buy now!

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.


Why is this book free to read?

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.

Who is this book for?

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.

Why exercises?

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.

How long will it take me to solve all the exercises?

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.

How technical is the book?

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.

Is the app mandatory?

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.

Can I learn to make apps from the book?

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.

Do I need a mac to learn Swift?

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! :)

How can I help?

You can send us a mail to say thanks – [email protected]

You can tell other people about the book and share it on facebook or twitter!

1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 4.50 out of 5)

  83 comments for “Learn Swift Programming from Scratch

  1. Intekhab
    December 5, 2014 at 11:56 pm

    Great stuff! Keep going! :)

    • December 6, 2014 at 1:53 am

      Thanks! All the chapters should be published until X-mas :)

      • kenny
        February 16, 2015 at 5:22 am

        Hi when can i expect the full version of your app to be available?

        • February 16, 2015 at 12:30 pm

          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.

  2. Melissa
    December 14, 2014 at 4:38 pm

    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.

    • December 14, 2014 at 4:52 pm

      Thank you for your kind words! :)
      Stay tuned for the rest of the book and more ;)

  3. Peter
    December 19, 2014 at 7:34 am

    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?

    • December 19, 2014 at 12:09 pm

      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!

  4. Jamolde
    December 21, 2014 at 10:18 pm

    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? :)

    • December 22, 2014 at 12:39 am

      Unfortunately no Java/Android content. I’m happy you like the exercises, I hope they will help your cousin :)

  5. Gary
    January 3, 2015 at 6:16 pm

    Do you have a newsletter we can subscribe to? If so, please add me.

    • January 3, 2015 at 8:08 pm

      Just did :)

      • Gary
        January 4, 2015 at 2:02 am

        Awesome! Much thanks!

  6. Alan Snow
    March 19, 2015 at 1:32 am

    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! :)

    • March 20, 2015 at 11:20 am

      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.

  7. Vinayak
    March 31, 2015 at 5:31 am

    Where is the download available for the above mentioned book? Is that available for free?

    • March 31, 2015 at 11:45 am

      No download – you can read the book on the site.

  8. Charles
    April 15, 2015 at 10:12 pm

    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?

    • April 17, 2015 at 2:35 pm

      The pdf version is now yet available.

      • Charles
        April 19, 2015 at 12:21 am

        Oh, were can I read this then?

        • April 22, 2015 at 5:19 pm

          we highlighted the chapter on the page :) – hope that helps you find them

  9. DMORG
    May 4, 2015 at 1:53 am

    Thanks for taking this approach. I would love to get a t-shirt and get access to the larger demo.

    • May 4, 2015 at 3:50 pm

      :) We are going to relaunch the campaign in a few weeks. Subscribe and you will be notified as soon as we do it.

  10. Zach
    May 26, 2015 at 6:43 pm

    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?

    • May 27, 2015 at 8:48 am

      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.

  11. Micky
    June 4, 2015 at 10:16 pm

    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!!

  12. Justin Uberti
    June 11, 2015 at 6:29 am

    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?

    • June 11, 2015 at 9:40 am

      No. We are going to update the demo soon.

  13. June 17, 2015 at 1:11 am

    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.

    • June 17, 2015 at 1:54 am

      We are working hard on launching the app :) – should be out by the end of the week

      • Lisa
        June 17, 2015 at 5:40 pm


  14. June 20, 2015 at 2:43 pm

    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!

  15. Chorlito
    August 15, 2015 at 5:35 pm

    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.

    • Chorlito
      August 16, 2015 at 1:03 am

      Found it.. :)

    • August 18, 2015 at 10:57 am

      You can find solution in the book :)

  16. David Katz
    September 12, 2015 at 7:47 pm

    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?

    • September 14, 2015 at 6:41 am

      We are working on a series that teaches core iOS concepts – about one is posted each week – stay tuned!

  17. joe
    October 7, 2015 at 6:01 am

    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.


    • October 7, 2015 at 6:57 am

      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.

  18. Snehal
    October 15, 2015 at 1:18 pm

    Now if i buy the app, what about future updates? will the updates be free?

  19. Dan Stocks
    October 15, 2015 at 6:55 pm

    Will you be updating the website copy of the book to fully reflect Swift 2? Still refers to println in the code examples.

    • October 15, 2015 at 6:56 pm

      yes. The book will be updated in a few days.

  20. Stefan DeClerck
    December 12, 2015 at 7:07 am

    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

  21. January 18, 2016 at 4:40 pm

    My computer won’t let me open the app, saying it’s from an unidentified developer. Is there a way to get around this?

  22. Paul
    February 3, 2016 at 4:49 pm

    If I buy the exercise platform, does it also come with the book?

    • February 3, 2016 at 4:51 pm

      yes. And if you pre-order the iOS Spellbook you get both the swift from scratch book and exercise platform as a bonus.

  23. Dillon
    June 25, 2016 at 11:07 pm

    Will you be updating this for Swift 3?

    • June 27, 2016 at 7:47 pm


      • George Stefatos
        September 19, 2016 at 8:56 pm

        When will the exercise platform be updated for swift 3?

        • October 3, 2016 at 10:35 am

          In a few days. Still working on the update. Sorry for the delay!

          • October 7, 2016 at 12:19 pm

            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. ^^

  24. Kawin P
    October 10, 2016 at 5:37 pm

    Hi Andrei, any word on the Swift 3 update for the book and the training app?

    • October 10, 2016 at 5:41 pm

      The online version has been updated. Currently deploying the update. Shouldn’t take more than a few hours now :)

  25. Uwe
    November 26, 2016 at 6:32 pm

    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

    • November 26, 2016 at 6:52 pm

      You have to move the app in the Applications folder.

      • Uwe
        November 27, 2016 at 9:00 pm

        Thanks, works perfectly.

  26. Abdullah Ahmad
    December 2, 2016 at 12:24 am

    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.

    • December 2, 2016 at 7:37 am

      yes – you used your brain to do the math instead of the computer. a is (sum + diff) / 2 and b is sum - a. this will work for all cases not just for sum = 16 and diff = 4.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

We send about one email per week with our latest tutorials and updates
Never display this again :)