in Opinions

Best feature of Swift

It’s been a bit more than a month that I’ve been playing around with Swift. I’m still in the awe phase. Programming with Objective-C has always been fun, but with Swift it gets better. Kudos to Apple’s engineers for developing a well thought out language.

Swift fixes a lot of C’s and Objective-C’s shortfalls. It is designed from the ground up to be a safe language where memory management and common programming errors and are thing of the past.

One of the biggest gripes I have with objective-c is that NSArray didn’t return a typed object. Every object we get from an NSArray must be cast into a temporary variable in order to use it.

Java had typed arrays for a long time but it wasn’t enforced by it’s compiler, so programmer got away with defining untyped arrays.

In Swift this is all gone, all arrays and dictionaries are typed from the moment they’re defined.

Writing in Swift should make for more stable programs, quicker updates and better code portability from one project to another.

In my honest opinion, I believe the automatic type inference and Array/Dictionary typed value is the best feature of Swift.

What about you? What feature of Swift you like the most?