Alexito's World

A world of coding 💻, by Alejandro Martinez

Objective-C keeps improving

Yes, the title is not wrong. Apple just released Xcode 6.3 beta that includes multiple huge improvements to Swift 1.2 solving a lot of concerns that we all had. But the cool part is that indirectly Objective-C also has improved.

Nullability may now be expressed in Objective-C headers — New Objective-C extensions in Clang allow you to express the nullability of pointers and blocks in your Objective-C API. You can provide Objective-C frameworks that work great with Swift code, and improve your Swift experience when mixing and matching with Objective-C code in your own project.

I’m a big fan of Swift, I really think it’s the future. The language is still pretty young and the tools are not mature enough but I see that Apple is making a big effort on changing this, you just have to see this last release. But even being a fan of the new language I’m still are a big fan of Objective-C. I really like it.

I totally get the improvements that Swift adds to our code, mainly to remove a whole category of bugs, type safety, immutability, etc. I’m not a compiler expert but it’s obviously that a lot of things that Swift bring us are implemented on LLVM, and so Objective-C can receive some of those improvements too. (maybe the blocks were introduced in Objective-C thanks to being added to the compiler for Swift?)

Even now we see how the old language keeps receiving updates. Features that are a big deal in Swift are, in a small way, ported to Objective-C. So at this point one can question if we really needed a whole new language. Objective-C 2.0 introduced some big changes, so I could see a future Objective-C 3.0 introducing a lot of concepts that we consider essential in Swift. Seeing people trying to improve the language (read Building a Better Objective C by David Owens) only reinforces that feeling.

I cannot wait to see the future of Swift.

If you liked this article please consider supporting me