Swift Review

swifticonIt has been almost been one year since Apple released Swift, their new developing language for iOS developers. Swift has had a big impact on iOS and OS X Developers and many people tried out Swift when they announced in the beginning of June last year at WWDC 14. But why did Apple switch from Objective-C to Swift? How has Swift changed the way developers make their apps? Is it better for a beginner to learn Swift or Objective-C first?

Apple has not really “switched” from Objective-C to Swift. They added Swift because it allows the transitions for developers from different backgrounds to start developing for iOS and OS X much easier. Swift is very similar to other modern developing languages and Apple did not want to confuse developers. The second reason why Apple came with Swift was for convincing more developers to make apps. With a language with easier syntax, more developers would want to make apps for iOS and OS X devices which is beneficial for Apple.

Aside from the reasons why Apple created Swift, why is this language easier to use? For a beginner, Swift is easier to use because:

  1. Less files. Only one swift file per view controller instead of two confusing .m and .h files.

    One swift file per view controller
    One swift file per view controller
  2. Easier syntax. There is cleaner code which helps to debug, read, and maintain. For example the optional semi-colon means that developers don’t have to put a semi-colon after every statement. And the less problems that a developer has to face, the better.
  3. Playgrounds. A feature that Apple has released in Xcode 6 along with Swift.playground
    • Can be used to design a new algorithm, watching its results every step of the way.
    • Can be used to Experiment with new APIs.
    • Can be used to be more familiar with the Swift language.
  4. LLVM Compiler. Using the high-performance LLVM compiler, Swift code is transformed into optimized native code. This means that Objective-C code can be compiled with Swift code by using a bridging header.
  5. Safe. Variables need to be initialized before use, arrays and integers are checked if they are overflowing, and memory is managed automatically. This helps preventing problems which can be a headache for the developer.
  6. Better Performance. According to Apple, Swift is up to 2.6x faster than Objective-C and up to 8.7x faster than Python 2.7.
  7. Easy to learn. Apple has released their own book that teaches the syntax of Swift and there are many online tutorials that teach how to make apps with Swift.

Back to the big question: “Is it better to learn Objective-C or Swift?”. For a beginner in iOS development, I highly recommend learning Swift first because it is easy to learn, the syntax is easy, and it is not any less powerful than Objective-C. A reason why learning Swift could not be the best decision is because not everyone has adapted from Objective-C to Swift. I would say that Apple is very successful in making iOS and OS X development easier with their new powerful language.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s