In case you haven’t heard, Apple just introduced a new language for iOS and OSX developers called Swift. It has come to light that Swift was in the works since 2010, which is 2 years after the first SDK was released. Apple saw the limitations of Objective-C which is almost 30 years old and decided it was time for a change. However, in true Apple fashion, they did not want to release a half-baked language. They realized that no matter the drawbacks of Objective-C, they could still push the envelope with it, and so they did.
It’s been six years since the release of the first SDK and 1.2 million apps have been submitted to the App Store. Millions of developers have suffered through learning the arcane syntax and limitations of Objective-C. Recently, a vocal few decided to speak up expressing their woes about the outdated language.
Swift probably took a little over four years to create and is the result of the work of many smart individuals who love crafting a new language. They looked all around for inspiration and not only created a new language but tools to along with it that would make it easy to learn.
When talking about Swift, Apple refers to three key considerations: Safe, Modern and Powerful. It lives up to all those three things. Outlined below are some of the very basics you need to get up and running with Swift. If you already know a programming language, then you will see a lot of similarities with other modern languages. You might even wonder why they had to invent a whole new language, but that is discussion for another blog post.
Using Swift
Firstly, you will have to download and install Xcode 6. Once you have installed it, open it up and select File from the menu -> New -> Select Source on the left under either iOS or OSX -> Playground. Give your playground a name and you are ready to get started. Alternatively, you could use the REPL (Read Evaluate Print Loop) from the terminal.