Welcome to Learning Swift.

This is the first post in what I hope will be an extensive series dealing with the Swift language. Here are some of the questions I hope to answer:

  • Should I learn Swift? Why?
  • Why is Swift so great?
  • How should I start learning Swift?
  • I already know Objective-C - how do I convert?

After that, I am planning a series of posts discussing the major differences of Swift from the view point of an Objective-C programmer and the aspects of Swift that I found difficult to grasp. Topics covered will include such things:

  • optionals
  • closures
  • functional programming
  • protocols
  • generics

I am coming from a background of Objective-C, so many of my posts will be dealing with aspects of Swift that are not familiar to Objective-C programmers. I will not assume any Objective-C programming experience, but some features of Swift that are new to me, will be familiar to people accustomed to other languages.


So let’s start by answering the first question:

Should I learn Swift?

If you are writing or planning apps for any Apple platform - YES. If not, wait until Swift is available for the platforms you need to support.


Why?

If you are already an iOS or Mac developer: YES

This is the new language and Apple is very committed to it. Objective-C is not going away any time soon, but Swift is where it is going to end up, so why not make the jump now while the language is still in development? You have to accept that fact that every release of Xcode is going to break your code, but the automatic re-factoring works very well. And by moving to Swift now, you get the chance to influence the direction of a new language. How often does that happen?


If you are starting to learn iOS or Mac development: YES

If you have no history with Objective-C, then do not waste your time learning it. There is still a lot of sample code out there in Objective-C, but increasing numbers of tutorial sites are using Swift and converting their existing tutorials to Swift. It will help if you know just enough Objective-C to read it, but you do not need to know enough to write it.


If you do NOT program for Mac or iOS: NOT YET

Swift went open source in late 2015. This is a big deal and Apple’s plans for Swift are quite clear. They want Swift to be such a main-stream language that it is used instead of Java for basic computer science courses in universities. This was never going to happen unless the language was open-source and cross-platform. It is now open-source and available for Linux as well as Mac/iOS. While Apple has not yet released any further ports, I think there are more on the way for Raspberry Pi, Arduino and other embedded systems as well as server-side Swift libraries like Perfect. I expect that a version for Windows will not be far behind.