What language are iOS apps written in?

There used to be only one language for iOS app development. That has changed.

What language are iOS Apps written in? Most modern iOS apps are written in the Swift language which is developed and maintained by Apple. Objective-C is another popular language that is often found in older iOS apps.

Although Swift and Objective-C are the most popular languages, iOS apps can be written in other languages as well. The language that will be best for your project will depends on your needs and resources.

Swift

Swift is a language released by Apple that is not only powerful but also intuitive and easy to use. It is a modern language based on the latest research on programming languages. Some of swifts highlights include:

  • Great memory management
  • Variables are always initialized before use.
  • Array indices are checked for out-of-bounds errors.
  • Structs that support methods, extensions, and protocols
  • Optionals ensure that nil values are handled explicitly.
  • Functional programming patterns, e.g., map and filter
  • Native error handling using try / catch / throw
  • Works with exiting Objective-C code
  • The safety features of Swift are what I found the most amazing. Swift eliminates entire classes of unsafe code. Swift objects can never be nil, the compiler will prevent this the app from building. This prevents the dreaded null pointer exception during runtime! Optionals can be nil, but must be explicitly unwrapped before their use.

Swift was released in September 2014 with the launch of Xcode 6.0. Swift placed in first for Most Loved Programming Language in the Stack Overflow Developer Survey in 2015.

Many companies have incorporated Swift into their iOS app, some are even fully written in Swift. These companies include:

  • Lyft
  • Khan Academy
  • Kickstarter
  • Hipmunk
  • Clear
  • Sky guide
  • LinkedIn

Most iOS applications written today are being written in Swift. It is the robust language that Apple is always improving. Performance is a key metric that the Swift team is serious about improving.

A common search algorithm in Swift runs up to 2.6x faster than Objective-C and up to 8.4x faster than Python 2.7.

-Apple

Swift is also an open source project available for everyone. The main community site is swift.org. Apple has released an iPad app that allows you to learn serious code from anywhere. Educators and universities are beginning to teach Swift in their lectures and classes.

In my opinion, Swift is one of the best languages I have ever worked with. I found it easier to learn than most languages and I really appreciated how modern it is. It is well thought out and I think Apple optimized the developer experience to be as pleasurable as possible. The developer community behind Swift is also very strong and growing rapidly everyday. There are a lot of third party plugins and libraries that you can find online for your specific app’s use case.

To learn more about Swift, check out the developer website or download the official book for free.

Objective-C

Objective-C was the original language Apple released for iOS app development prior to Swift. It was first released 24 years ago in 1984. Objective-C is a thin layer above C and derives its syntax from a language called SmallTalk.

Compared to Swift, Objective-C’s syntax is very verbose and can be difficult to read. If you’re working at an older company where the app was built before Swift was released in 2014, it is very likely you will have to work in both Objective-C and Swift.

Objective-C and Swift can work together quite well, Apple designed it so the transition between Objective-C to Swift would be smooth for engineering teams.

Objective-C requires you to manage your own memory more, specifying pointers when necessary. It also is not as safe as Swift as you can run into null pointer exceptions.

There are some benefits to Objective-C including:

  • Well tested and stable
  • Easy to learn for developers comfortable with C & C++

Some of the cons include:

  • Hard to learn
  • Hard to read
  • Not as safe as swift
  • Less developers are learning Objective-C, could make it hard to hire Objective-C developers
  • Overall, Objective-C was a great language Apple released – however most developers and teams should look to use Swift if they are developing a new platform.

Javascript with React Native

Javascript is the main language full stack and web developers learn. Therefore, there is a market for Javascript app development. Facebook has released a library called React Native that allows developers to use Javascript to build native iOS apps.

React Native borrows a lot of similar concepts from Facebook’s frontend library React. Developers familiar with React development will find React Native development quite similar and easy to pick up.

However, there are some drawbacks as native app development has some different paradigms compared to web development. Memory management is handled very differently as there is no browser to handle memory for you. Performance is also not the greatest when writing apps in React Native

The reason teams pick React Native is to have a unified code base for both Android and iOS apps. React Native is designed to be able to deploy to both Android and iOS. However, some teams such as AirBnB found that although React Native aims to make two problems into one, it can easily make two problems into three. AirBnb discontinued their use of React Native due to multiple organizational and engineering problems.

React Native definitely shows some promise, but it is too early to tell if it will become a viable replacement for most iOS apps. Many other frameworks have tried and failed before, so we’ll just have to wait and see.

The React Native community is also very strong and dedicated to making it better every day. I am excited to see what will happen in the next 5-10 years with this library.

Dart with Flutter

Dart is a language released by Google that aims to be productive, fast and approachable. It looks very similar to Java or C++, developers familiar with those languages can pick up Dart in a matter of days.

Flutter is a library released by Google that allows developers to build beautiful apps in record time. Some of the benefits include hot reload, expressive UI and native performance.

Flutter has built in widgets that allow you to build an iOS or Android app just like how it would look in native app. Highly responsive interfaces that will work even for heavy gaming apps.

Its widgets layout system makes reasoning about the user interface simple and easy to debug.

Personally, I really like Flutter and think it has a great future ahead of it. The snappy performance and easy developer experience make me hopeful. Its developer community is growing rapidly and there are lots of tutorials and templates for new developers to get started quickly. The Flutter team also provides very good educational material for those learning app development for the first time.

C# with Xamarin

Xamarin was founded 7 years ago in 2011. It aimed to provide tools develop apps targeted for Windows, iOS and Android platforms.

Windows Phones are not widely used today, but this framework still exists. Developers can find Visual Studio Tools for Xamarin to continue using it today.

It is an open source platform that can develop apps on a Mac or a Windows computer. It has built-in native user interfaces, so the apps feel just like they would if developed on the native language.

Apps built using Xamarin are able to leverage hardware accelerations of each of the platforms. This enables Xamarin apps to have great performance that users can experience.

Although the popularity of Xamarin has died down, it is still a viable platform for developers looking to use C# to code their iOS apps. Microsoft open-sourced the library and integrated it into their Visual Studio IDE in 2016.

Can I write iOS Apps in Java? No, at least not easily. It is not recommended as there is little support in this community. Codename One is a library that may support this.

Can I write iOS Apps in Python? No, it is also not supported or recommended. There is little support in the Python for iOS community. BeeWare is a library that may support this.

If you liked this post and want to learn more, check out The Complete iOS Developer Bootcamp. Speed up your learning curve - hundreds of students have already joined. Thanks for reading!

Eddy Chung

I teach iOS development on ZeroToAppStore.com.

Similar Posts