How do I start to learn Swift?


The first thing to do is to download the latest version of Apple’s Swift Programming Language book from the iBooks Store.

You can just read this book, especially the first section: “A Swift Tour”, but you will get more out of it if you follow along with the playground. There is a link to download the playground from the book which you can use directly if you are reading using iBooks on the Mac. If you are not, here is the download link.

You will also need to install Xcode from the Mac App Store. Xcode is Apple’s IDE and is used for programming Mac, iPhones, iPads, Apple Watches and Apple TVs.

Swift introduced the playground to Xcode. A playground is a fantastic way to learn and experiment. You do not need to create a project, build, run a separate app, install on a device. Code typed into a playground is run immediately and you can see the results instantly, line by line.

Here is an example of a playground showing the code on the left and the result of each line appearing on the right.

Playground


Once you have gone through the Swift Tour, Apple’s book becomes more of a reference guide to return to whenever you get stuck. The other way I use it is to check up on changes made when a new version of Swift is released. As the language is still rapidly evolving, these can be quite extensive. Once I have the latest version of the book, I go to the Revision History at the back and click the links to read about the features that have been added or changed.


Apart from Apple’s documentation, there are a lot of great web sites, blogs and Twitter accounts out there. There are also useful newsletters that give a weekly summary of exciting developments.

Here are some of my favourites:

  • Natasha the Robot - my favourite Swift blogger - sign up for her newsletter and follow her on Twitter.
  • Apple’s Swift Blog - not many posts, but good for learning about new features.
  • Erica Sadun - sometimes a bit too technical for me, but often contains some really useful snippets. Erica has the distinction of being the first person outside Apple to have had a Swift language proposal accepted as part of the open source development process.
  • Andy Bargh - detailed articles on various aspects of Swift, plus a weekly newsletter.
  • Ray Wenderlich tutorials - search for Swift and find heaps of tutorials covering many different aspects.
  • Swift Sandbox - weekly newsletter filled with interesting articles.
  • SwiftMonthly - useful newsletter with links to tutorials, videos and projects.
  • SwiftDoc.org - the documentation in Xcode is still heavily skewed towards Objective-C programmers and it can be difficult to find Swift-specific entries. This site makes it easy.

And I hope you will keep coming back to this site to see what new Swift-related articles are available.


Tags: swift   learning swift