Should You Use Objective-C or Swift?

At the moment Apple has two major programming languages. So should you use Objective-C or Swift?

General Considerations

Although Apple says that both programming languages are treated equally, it is very clear that the future belongs to Swift. Just take a look at the talks of the WWDC 2015: There were a lot of talks about Swift but just very few about Objective-C. And the only new features of Objective-C are about improving the interoperability of Objective-C with Swift.

Apple will support Objective-C for a long time. However, Apple is not that kind of company that supports two major programming languages for ever. So in the long term perspective, Swift is the future.

Nevertheless, you should take in consideration that Swift is very young and that the language is still changing. With Swift 1.2 and Swift 2.0 existing code needed to be migrated and that could happen in the future as well.

Existing Projects

Should you migrate your existing Objective-C projects to Swift? In my opinion definitely not because the effort is to0 high and there are not so many advantages. However, it could be a good idea to write new classes in Swift because the interoperability of Swift with Objective-C is very good. This way you have the possibility to use Swift in a real project and the projects get migrated step by step.

New Projects

For new projects the situation is completely different. Here you have the possibility to use Swift right from the start. If you take into consideration that Swift is the future of iOS development, it is a very good idea to use Swift. There are already a lot of projects done in Swift and generally Swift is ready for real projects. The only potential problem is, that there could be the need to migrate your projects to new versions of Swift.

Conclusion

Generally, it is a good idea to use Swift whenever you can. However, the effort to migrate existing Objective-C projects to Swift is too high.

References

Image: @ Peshkova / shutterstock.com

Book Tip

Big Nerd Range Guide: iOS Programming: Excellent introduction to iOS development. Some programming experience is recommended.

Amazon