There are a lot of people asking me now and then about whether to start learning Swift or Objective-C to get into the mobile dev scene. Also, a lot of people that develop for other platforms are often curious about Swift and Objective-C. This is for both of you, to get to know a bit more about the subject of the mobile platform languages available for iOS.
Ok, how about the main question?
But, going back to the question, whether Swift or Objective-C? The answer is clearly: SWIFT! Don’t even think a bit getting into one of the most complicated and ugliest languages ever, Objective-C. It’s old, it has a steep learning curve, and in my opinion, going to disappear in 5 years.
I have more questions though!
Now if that alone isn’t reason enough, I’ve compiled a few questions that you might ask when trying to decide.
1) Who invented Swift and when?
Well, Apple, by the hands of Chris Lattner (now working at Tesla), who started with the idea back in 2010 of a new, more modern, saver and easier to understand programming language, and eventually convinced other Apple engineers to work on it, until it was finally and officially released September 9, 2014. I would say, right on Chris. Thank you for your greatness and contribution to the mobile development world.
1) Is Swift capable of doing everything that Objective-C does?
The short answer is yes, the longer answer would be no. But, for 99,9% of the things that you’re going to be facing during your first good 3 years into mobile development, you’ll never even touch Objective-C code. And as us you’re starting only now, it will be almost gone by then.
2) Is Swift stable enough?
Hell yeah. Swift is open source, and that means a lot of people are involved with the language creation part and that means more people testing, more people being creative as for finding solutions, and there’s Apple behind it, approving what goes in and what stays out. So no question here, Swift 3 is as stable as it can get.
3) What is easier, Swift or Objective-C?
That one is easy. Taking into consideration that you don’t know any of them, what looks more user-friendly to you?
NSString *myVar = [[NSString alloc] initWithString:@"Hello"];
str = [str stringByAppendingString:@" world"];
var myVar = "Hello"
myVar += " world"
4) So I heard about Swift 3.0, is there a Swift 2.0, 2.x?
Yes, there is Swift 2.3, but forget about it. It is possible that coming iOS 11 this June, support for Swift 2.3 will be dropped. So learn 3.0. There are significant changes, the tendency is always to simplify things. When searching on Google for code, add swift3 at the end of your search terms.
5) Is Swift going to be supported by other platforms, like Android devices or other desktop operation systems? Is it therefore a good investment?
Yes, it is a good investment. IBM is getting some Swift tools distributed, you can run Swift as bash scripts on Ubuntu Linux distributions, and there are a group of people trying to port Swift to the Android scene. Swift is so attractively simple that it is going to be the language of the future for morenthan Apple’s platforms.
6) Ok, got it. I want to give it a shot, where do I start?
Buy a Mac. Open a free developer account. Download Xcode. Open it up, create a new Playground, and you’re off to get a good taste of it. A playground is a Swift code file, a place to learn and test Swift Code, and as it gets more and more sophisticated, you’ve be spending a lot of time here learning the basics of Swift. And a good place to get a hold of the basics is here. And all the rest, as much cliche as it may sound, Apple is the place to go. The master the art of simple documentation.
Still not clear enough?
Drop me a line via Twitter if you have any questions, my DM’s are open. This should get you started and boy, what a journey it will be.