Let’s Swift some Swift

Image

Few days at Apple World Wide Developer Conference 2014 Apple released a new Programming language called Swift. Many developers think this one of the most surprising, and yet important announcements apple made. Apple was well associated with the former programming language, Objective-C. Which was first used 25 years ago when Steve Jobs founded NeXT.

Objective-C was built on the top of the C programming language, and In the last few years, and especially after Apple success in the iPhone, Apple kept adding features and fixes to make of Objective-C a modern language like fast enumeration, Literals.

However, due to the popularity that iOS got in the last few years, and the increasing number of developers. Who actually came from different backgrounds, and programming languages, Apple found itself in front of an increasing need to come up with new syntax to make development for its platforms more developer-friendly. People who even code in Objective-C call it the ‘weird language’ (calling a method using square brackets, huh?) 
[myCar drive];

Swift adapts a new syntax that is familiar to developers who come from a Java or C# background.
myCar.drive()

However, Swift drops some needless syntax details like semicolons, and adds over with features like REPL (Read Evaluate Print Loop) programming, and with Xcode new feature playgrounds, where you can test an algorithm or a function without actually having to compile, link, run and see if it works, it’s all done at real time while you’re typing your code. Swift also gives additional features to methods, where a method can have more than one return type, in what Apple calls as tuple.

The new programming language undoubtedly give developers more space to do amazing productions with less coding, and more freedom in syntax with less restrictions and without the need to worry about pointers, and safety issues because Swift does all of that automatically for the developer, and make the code more concise, readable, and a lot safer.

Will Objective-C die?
No at all, Apple published all of its new APIs in both flavors (Objective-C and Swift) and developers can choose any of them to use. Objective-C has been in use for more than 25 years, and people got used to it.

Apple is bridging the gap between modern programming and its platforms with a Safe, easy to use, and concise programming language to make development for iOS open for more users. In case you’re looking forward to learn iOS programming I highly advice you to start now, because at this time everyone is a beginner. You can learn Swift from the iBook that apple published here
https://itunes.apple.com/us/book/swift-programming-language/id881256329?mt=11

Just a quick note Swift now supports different languages in variables names. Including Arabic. I tried the following

let س: Integer = 4
return س
and it works 🙂

Jamal Kharrat

Jamal Kharrat is a Computer Science Sophomore at Illinois Institute of Technology, with an endless passion in Mobile Development (Objective-C, Swift), Interested in Cultures/Linguistics, Graphic Design, and Technology in general.

One Comment Add yours

  1. gpdoyle says:

    A little more introduction directly from the Apple website:

    Modern
    Swift is the result of the latest research on programming languages, combined with decades of experience building Apple platforms. Named parameters brought forward from Objective-C are expressed in a clean syntax that makes APIs in Swift even easier to read and maintain. Inferred types make code cleaner and less prone to mistakes, while modules eliminate headers and provide namespaces. Memory is managed automatically, and you don’t even need to type semi-colons.

    Code
    Swift has many other features to make your code more expressive:

    Closures unified with function pointers
    Tuples and multiple return values
    Generics
    Fast and concise iteration over a range or collection
    Structs that support methods, extensions, protocols.
    Functional programming patterns, e.g.: map and filter

    For more details, please visit:

    https://developer.apple.com/swift/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s