Do you keep hearing about Swift? Do you want to know more about it? Then you’ve just discovered exactly the right article! Today we’re going to give you a complete introduction to what exactly Swift is, and why it’s so important for app developers. Not only that but we’ll be providing info on the best places to learn as a beginner, a list of great online resources on iOS development and mobile app programming, and the low-down on what you can use this sought-after programming language for.
What is Swift?
Swift is a general-purpose, multi-paradigm, compiled programming language created for iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. It is an alternative to the Objective-C language which was the recommended and most popular language for building apps for Apple’s ecosystem of devices.
Swift, rightly named after the Swift bird (which is among the fastest fliers in the animal kingdom), was developed to be a faster alternative to Objective-C. Other than speed, Swift offers other advantages over Objective-C, including ease of learning, safety, requires less code, is interactive, among other things.
For beginners or those completely new to the field, I’m going to be explaining Swift and and Objective-C in more detail so you know the advantages and disadvantages of each.
Compared to Objective-C, Swift has a simpler syntax that makes it easier to learn for beginners or for anyone coming from another programming language. The language took language ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list. This means that programmers coming from other languages or from other platforms (such as web development) will find a lot of concepts in Swift similar to what they were used to.
Objective-C’s syntax is quite verbose. It is also quite different from other programming languages. Take the below code comparison as an example. The first two statements shows some code in Objective-C and the other two statements shows the same code in Swift.
NSString *str = @”hello,”; str = [str stringByAppendingString:@” world”];
var str = “hello,” str += “ world”
If you are coming from another programming language, you will be able to understand the second piece of code as it is similar (with slight differences here and there) to how variables are declared in other programming languages. Even for a beginner, the second example code seems less intimidating than the first.
Swift is still a rather new programming language but its popularity and adoption has been increasing faster than any other language. It is now the most popular language to develop for Apple devices. Some popular apps built using Swift include Lyft, Khan Academy, Clear, Sky Guide, LinkedIn, Strava, Yahoo Weather and Hipmunk. Because it was open sourced by Apple, we are bound to see its use spread to include development for other platforms other than Apple devices. As of now, there is already a compiler for it for Linux. This is a huge step-up from Objective-C which could only be used on a Mac OS machine. Swift was released under theApache 2.0 license, which means developers can use it as they like — even in commercial products.
This is still really new and speculative, but rumor has it that Google might be considering making Swift a “first class” language in Android development. This would be good news to anyone who already knows Swift since porting their app to Android will now be an easier process that won’t require acquiring additional skills. Facebook and Uber are also apparently looking to make Swift more central to their operations.
A benefit of Swift is that it can serve as both a forward-facing language as well as a server-side one. For a product like Facebook, that’s beneficial; apps and servers can speak to one another seamlessly, and it potentially gives the company a wider scope to write APIs for services.
Swift is still evolving and it will be interesting to see what it grows up to be and what it will be used for in the future. Since its announcement at WWDC 2014, Apple developers have continued working on it, releasing incremental versions. Swift 3.0 is expected to be announced at this year’s WWDC 2016 conference with an official release set for Fall. The major goal of this release is said to be portability, meant to make it more portable to other platforms. Whatever the future has in hold for Swift, its growth and popularity has increased job demands for it. It is a good time to be or to consider becoming a Swift developer.
Where to start when learning Swift
There are numerous resources you can use when learning Swift. We cannot give an exhaustive list, but we’ll mention some resources that you might find useful.
Official Apple Documentation - The Swift website is a great place to start to find out about the language and to also keep abreast of new developments. You can also learn Swift from the free Swift book from Apple. You can read it online or download an iBooks version for offline viewing. To get started building your first iOS application, you can check out this tutorial that shows you how to build an app from scratch.
Each year, Apple hosts the World Wide Developer Conference, where they announce new devices and changes to their SDK. They also hold different talks that teach developers how to implement the newly introduced libraries and technologies. Videos of these talks are available on the WWDC website. They are a valuable resource to developers.
Be sure to read through the design guidelines for whatever platform you want to build for. For iOS, there is the iOS Human Interface Guidelines, for OS X, there is the OS X Human Interface Guidelines, for tvOS, there is the Apple TV Human Interface Guidelines and for watchOS, there is the Apple Watch Human Interface Guidelines. These are documentation you will be referring to repeatedly throughout your career as an iOS developer.
Newsletters - These are great to keep up with the latest news on Swift and also to discover great articles and tutorials on Swift and iOS development: iOS Dev Weekly, This Week in Swift and Swift Weekly.
- You can also find some free and premium courses online to learn from. Some of them are: Stanford’s’ CS193P iOS Development Class (this is available on iTunes for free. The only disadvantage is that the latest class posted is on iOS 8. It’s still useful in learning Swift though), Hacking with Swift is a Swift book that is free to read online, with premium options for offline viewing, Coursera offers some courses on iOS development that are free to take with premium options for code review and certifications, Udacity offers free video courses on iOS development with premium options for mentorship and certification.