Become an iOS developer.
Swift is a new programming language developed by Apple for iOS and OS X. As we were preparing to create a course on how to use this new language, we asked you what questions you had about Swift, and you responded!
1. Why is the language called Swift?
We could make the obvious popular culture joke, but in all seriousness, the language was designed with two goals in mind:
- swift to code
- swift to execute
In terms of speed, Swift uses the LLVM compiler, and compiles Swift code to optimized native code depending on target device. In terms of learning curve, the Swift syntax was designed to be clean and easy to read.
2. Should I learn Swift or Objective-C?
Whether you should learn Swift or Objective-C was the basis of a discussion back in September, and the answer has not changed – Swift! Apple has made it clear that Swift is the cornerstone of the future of iOS development. Plus, you can still utilize Objective-C files alongside Swift code, so you won’t miss out on any pre-existing libraries and code.
3. How easy is Swift to learn?
Swift was designed to be friendly for new programmers, and as a result it is incredibly easy to learn. According to Apple, Swift is the “first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.” Some have even called Swift the new BASIC.
4. Is it fast?
Apple boasts that Swift is up to 2.6x faster than Objective-C and 8.4x faster than Python 2.7. And why should you care about how quickly code executes? Well, faster running code makes for more efficient and smoother running apps, which makes for a better experience for your user.
5. Why did Apple decide to create a new language?
Objective-C has been Apple’s primary programming language for app writing since OS X was created. In that time, programming languages and practices changed drastically, especially in mobile development. Rather than adopt a new, already existing language, Apple created a new language tailored specifically for development on their own hardware.
6. Can I create an app in Swift and submit it to the app store?
Absolutely! In fact, you were able to as soon as Xcode 6 and iOS 8 launched.
7. Why was there a need to go from Objective-C to Swift?
As mention in the answer to question five, after 20 years, Objective-C was starting to show its age. Plus, Objective-C is a difficult language for new programmers to learn, so the barrier to entry is pretty high. Swift provides a modern language tailor-made for Apple hardware.
8. How stable is Swift?
As with any new language, there is a potential for bugs. While you may encounter some trouble with the Swift language, the majority of issues were addressed before the 1.0 release.
The thing to most look out for is changes to the Swift language during each update. For example, when updating from 1.0 to 1.1, Apple introduced a new feature: failable initializers. You can expect that the language will change as more people use it and give feedback to Apple. Stay apprised of changes using the revision history for The Swift Programming Language.
9. What other languages is it similar to?
Swift is probably most similar in look and feel to Ruby or Python. Though you’ll also probably recognize some C syntax.
10. Is it compatible with iOS 6 & 7?
Swift can be run on iOS 7, but not iOS 6.