HackHands

hack.hands() is an online service for live programing help available 24/7. Get Started

Posted on June 11th 2014

7 Things to Know about the New Swift Language

We recently sat down with HackHands Expert, Richard Clark, who is a Senior Curriculum Developer at Kaazing. Richard has taught for Apple and Hewlett-Packard, written immersive simulations, developed high-performance web applications for the Fortune 100, and published Apple iOS applications, so we were excited to hear what he had to say about Swift, Apple's newest programming language.

Here is what Richard told us about Swift. Check out our video interview with him below for more great insights that you should know about Swift.

1) What is Swift

Swift is a brand new programming language by Apple built on a modern compiler infrastructure (Low Level Virtual Machine). Therefore, it allows you to write safe but strict code (eg. the compiler won't let you compile missing references in memory). Swift looks and feels a lot like a modern scripting language, making it a real pleasure to work with.

2) How is Swift different or better than Objective-C?

Objective-C is built like a layer cake, starting with the C programming language as the base, which is very low level like a portable assembly language. It is then layered with Apple's runtime model and topped with function closures and reference counters. This makes for a steep learning curve at first. With Swift, all these layers have been baked into the language in such a way that it's very straightforward. You don't even have to think about memory management at all, so the learning curve is going to be probably a quarter of what it is for Objective-C. This could mean people writing more reliable code from the start.

3) How does Swift integrate with Xcode?

Whenever Apple releases new APIs, technologies and languages, they roll them up to Xcode, so Swift is integrated in Xcode. Although Xcode is still in a developer only beta, they're remarkably open with Developer Program. This means you can actually register for free and get the developer version of Xcode. This will get you access to the tools and the current information and then if you want to start publishing applications, the first level registration is $99, which gets you some tech support for any incidents and the ability to publish applications.

4) Is Swift going to replace/kill Objective-C?

Objective-C is not dead... yet. There are still some corners of Swift that don't touch all parts of the runtime. However, Swift will be faster than Objective-C for a lot of cases because of optimizations that are very difficult to do in the C language. This could mean Objective-C is going to get phased out given that Apple has said they have designed Swift both as an Application language and as a Systems language (Apple's developers say that they've been coding in Swift for months).

5) What devices is Swift for?

At the moment Swift code runs on both iOS and OS X so it runs on both the desktop and mobile devices. According to the documentation, the Swift runtime requirement is so small, programmers are saying you're going to be able to deploy the code backwards even to older versions that have iOS and OS X so you won't have to have a clean break between Swift and Objective-C.

6) What does the Swift syntax look like?

The syntax of Swift looks very C like, with parentheses within functions for parameter passing. In terms of more dynamic languages, it looks closest to Ruby, especially the closure and meta programming syntax.

7) When should I start learning/using Swift?

Some developers are saying they're going to wait a year to let Swift settle out and for the language to shift. Apple is using Swift themselves, so Swift is not going away. It may be best to get started early to understand it well, even if the language is subject to change. A good way to get started could be writing new features and new applications in Swift.

Already started learning or writing applications in Swift? Get live programming support for Swift and many other programming languages on HackHands.

Get on the mailing list!
The latest major updates, and nothing else.