Reading time: 3 minutes
Swift is the newest language available for developing apps for Apple products — all of them! Though Swift is synonymous with iOS and iPhones, one of the exciting reasons to learn it is that you can also use this language to code for Macbook, iPad, Apple TV, and Apple Watch.
Chris Lattner started developing the foundations of Swift during his Ph.D. studies at the University of Illinois in 2010. After his Ph.D., while working at Apple, he gradually rallied support and funding for the new language.
Only a few people knew about the language in 2010, but collaborators were making significant contributions by 2011, and “[i]t became a major focus for the Apple Developer Tools group in July 2013,” says Lattner.
In 2014, Apple revealed Swift beta at their annual Worldwide Developer Conference (WWDC).
Before Swift, Apple products relied on Objective-C, a difficult language developed in the 1980s.
Apple introduced Swift to make it easier for people to write software for Apple devices. Swift is a simpler language with lots of new features that help coders identify errors and prevent issues that would slow down the programs we build. Many applications still use Objective-C, though. You can use both of these languages in the same application. Apple designed them to coexist.
Do I need to learn Swift?
We combed through more than 30 developer recommendations all over the web. Here are the pros and cons we found to learning Swift as a beginner coder.
What are developers saying?
We scanned the web for a cross-section of viewpoints. The folks we’ve quoted include individual developers engaging in public discussions. There’s also a more journalistic take (ArsTechnica). And last but not least, we added the views of a coding teacher who knows what students go through as they learn Objective-C and Swift.
- Compared to Objective-C, Swift is “Easier to learn and teach, harder to mess up” - ArsTechnica
- “I am an iOS developer and working with Objective-C. But now we are migrating our project into Swift. So it's better to learn Swift rather than Obj-C.” - Ashwini Bankar, Senior iOS Developer at TechnoPurple
- “I recommend a Swift first approach for both absolute beginners or those from different development domains.” - Pasan Premaratne, iOS Developer, Instructor in Objective-C & Swift at Treehouse
Example — What does Swift look like?
In programming tutorials, often the first lesson is a “Hello World” exercise. The goal: write a short program that tells the computer to display “Hello World” on the screen. Written in Swift, we can achieve this in one line, like this:
The same program in Objective-C looks like more complex, like this:
And this is the learning environment in Swift Playgrounds:
Next Steps — Learn Swift
If you’re eager to make apps, you’ll need a few things:
If you’re new to programming in general, the best place to start in Swift is:
- Swift Playgrounds - a colorful iPad game, no computer or Xcode required
Some of the best tutorials:
- Ray Wenderlich’s Swift Resources - Ray’s guides are among the most popular and trusted in the industry, mentioned in may top-10 lists by Apple developers. His style is friendly and approachable, often including cartoons. His free content is diverse and thorough. It includes blog-style programming essentials for those who have never done any coding. He also has loads of videos, cheat sheets, a podcast, newsletters, and books.
- Lynda.com - Often available for free with a public library membership, Lynda is popular because it’s accessible while also polished. Their courses range from novice to intermediate, broken into modules averaging 1 to 3 hours in length, with some project-based tutorials, e.g. “Build an iOS Messaging Application”. New courses are added regularly, keeping pace with Apple’s updates to Swift and iPhone features.
- Apple’s “Start Developing iOS Apps" Guide - Apple’s own guide to mobile development is spartan but very clear, with no distracting ads or gimmicks. The guide has an obvious flow, so it’s easy to see the structure of an app and how its many parts work together. Some knowledge of basic programming terminology would help, though they do include a built-in glossary of definitions relevant to the mobile app development context.
Want to hear about what it’s like to develop mobile apps with Swift? Check out CodeNewbie’s interview with mobile developer Alicia Carr.