× {{alert.msg}} Never ask again
Receive New Tutorials
GET IT FREE

Swift vs. Objective-C: What Should Beginners Learn?

– {{showDate(postTime)}}


Should beginners to iOS mobile game development learn Objective-C first, or is it all right for them to get started with Swift? In the Codementor Office Hours hosted by Benjamin Encz, the author of the Cocos2D and SpriteBuilder documentation, he briefly answers this question.


 

Picking Swift or Objective-C as a Beginner Game Dev

We are now starting to move to Swift, but I still think if you really want to get invested in game development for the iPhone, you should start with Objective-C. The main reason is Cocos2D is written with Objective-C, not to mentioncurrently all Apple frameworks are also written with Objective-C. So it is really helpful to understand Objective-C if you work with iOS.

Even if you want to call Objective-C code from Swift, if you understand both languages, it’s a lot easier to understand how you can call a certain method in Swift that is written in Objective-C.

Especially now, in the first year, there will be some rare cases where Swift will not support a certain feature, and you will probably have to fall back to the Objective-C code to actually accomplish some stuff. The third reason to learn Objective-C is that Swift has some weird cases where the performance is really poor, and sometimes people switch to Objective-C to work around this.

For the next one or two years, if you have time, start from Objective-C and pick up Swift later. If you want to start out from a small side project before you go through the rest, you can start out with Swift.

Swift vs. Objective-C: Performance Issues

I personally have not had any experiences with the speed or slowness of the Swift. There are a lot of good benchmarks out there, and most of these benchmarks tend to go in the direction where if you take an implementation in Swift, it will be much slower than Objective-C. However, if you tweak your code a little bit, you will get the speed of Objective-C.

In some ways, you have to understand the Swift layer of implementing other features, and how to get the old Objective-C speed. Generally, however, the two seem to be comparable.

Other Posts in this Series:

About Benjamin Encz

Benjamin started developing for the iOS platform in 2011 and has worked on a variety of enterprise apps to mobile games. He has written about graphics programming in WebGL, and is the author of the SpriteBuilder and Cocos2D documentation. He educates next generation of software engineers at Makeschool and also writes tutorials for them (you can also see their transcript of this office hours here.)




Questions about this tutorial?  Get Live 1:1 help from iOS experts!
Alan Santos
Alan Santos
5.0
10+ years in JavaScript, Python, C/C++, Assembly, Java, Js, R, Mobile
If you need someome to level up your skills or results read my profile before hiring. I have delivered projects/results using Python(Machine...
Hire this Expert
Miroslav Kuťák
Miroslav Kuťák
5.0
Get the best or money back! 2000+ sessions, #1 iOS & Swift Mentor, Senior iOS dev
11 years of professional iOS developer experience (iOS 4-16), 20+ AppStore apps, Czech Technical University graduate. Obj-C & Swift, strong in OOP...
Hire this Expert
comments powered by Disqus