All Case Studies Design Development Interviews Machine Learning Project Management

React Native vs Swift - Performance and Development Comparison

React Native has been trending in the tech news for a few years now. Since Facebook officially introduced it as an open source project, many corporations have leveraged it in development. It’s not surprising, as React Native holds a promise of building apps for multiple platforms at the same time.  Apps created with React Native nearly always shares most of the codebase. Some apps, like Facebook or Instagram integrate React Native into an existing, native app. Even if only some of your codebase is shared between different operating systems, it still can provide a save of time and, in consequence, money. But how does it stack up against Swift in practice?

What is Swift?

Announced in 2014 by Apple, the Swift programming language is solution for iOS-powered devices, but also for Linux and z/OS. Swift is an alternative to the Objective-C language that presenting a simpler syntax and modern programming language theory concepts. Currently the language in open source under Apache 2.0 license.

What is React Native?

React Native is a JavaScript framework for writing real, natively rendering mobile apps both for iOS and Android. It’s based on React, very popular Facebook’s JavaScript library for building web applications. Both React and React Native is open source under the MIT license.


Netguru builds digital products that let people do things differently. Share your challenge with our team and we'll work with you to deliver a revolutionary digital product. Create a product with Netguru.


whym-comparison-main (1).jpg

React Native vs Swift comparison

The story of React Native as a benchmark for Swift application

Both complex and small projects can take advantage of React Native, so we decided to directly compare the RN framework with Swift to see what the actual benefits are. We initially developed a whym for iOS only. Whym is a real-time translation app for travellers and tourism sector businesses, such as hotels and airports. App gives users 24/7 live interpreter access with in-app purchases system. After the app had been successfully released commercially, the client started to consider further development for other platforms with the capability to quickly launch the app on new operating systems. The client’s goal was to gain a large market share. Therefore, we recommended that they give React Native a try, because it would enable us to develop the app for different platforms simultaneously and share parts of the codebase.

whym-comparison-minutes (2).jpg

React Native vs Swift: Development process

The development process was similar on both React Native and iOS. There were slight differences in terms of the sequence of consecutive tasks. However, they did not stem from the inherent specifications of the environments.

The biggest advantage React Native gained over native development in Swift was the time scope. It took approximately 1.5 months to build the same application with Facebook’s framework both on iOS and Android. The process could have been shorter, but as it was our first released RN application, the process also involved research on the technology. On the other hand, the project scope was smaller than in the case of Swift, because the team had already discussed all the details with the product owner. That said, if we excluded these two variables the project would have taken the same amount of time. As the analysed application was quite simple, it was compiled from one platform to another within just a few hours.

Coding in RN was completed in 1,5 month, which is 33% faster than with Swift. It might seem to be a tiny difference considering the project’s scope. However, when you think about developing an app for Android and iOS at the same time, the difference will be much larger. Obviously, it will still take approximately 2 months, but you will need two separate teams that will work concurrently on each platform (up to twice as many engineers).

whym-comparison-language (1).jpg

When it comes to the design layout arrangement, it was more convenient in React Native. The framework offers hot reloading, which keeps the app running and facilitates injecting new versions of the files that you edited at runtime. This way, you don’t lose any of your states, especially when tweaking the UI.

Despite its maturity, React Native is still developing and still some components or native modules necessary for development is missing or existing solutions is underdeveloped. In many cases, you will find a ready npm package waiting for you to solve your problems thanks to growing React Native community and Facebook’s engineers involvement. There is a possibility that  you will have to build the required module yourself or hack some existing libraries to reach the expected result.

react native vs swift comparision

React Native vs Swift: Differences in Performance

In the last step, we ran performance tests to verify which framework was more efficient. We compared three variables: allocated memory, CPU usage and energy impact during different actions in the application: the first run, taking a call, and opening an URL from the app. We also compared the speed in opening and scrolling the language list to call (in frames per second).

There were no differences when it comes to the CPU usage and energy impact. We noticed that the application written in RN allocated more memory than the one written in Swift. Statistics show that RN apps require about 20 MB of memory to run RCTBridge and its other components. The application logic is kept in the memory as well. Despite the slight difference in the allocated memory, both applications ran smoothly and had a similar graphic performance. Both apps behaved in the same way on all tested tasks.

REACT-NATIVE-PERFORMANCE-COMPARISON.jpg

Was it actually worth to rewrite the application?

As proved in our case study, there are no major differences in React Native and native development, whether it comes to the performance or development process. RN has its advantages over Swift and vice versa. RN offers one advantage that is hard to argue against: it does significantly decrease the development time when you want to scale for multiple platforms, and as a result, saves you a lot of money. In most cases, while developing complex React Native Apps, you still need to use some native code to deliver specific functionalities. The amount of code written that way is still decreasing because of many RN improvements made over the years. Therefore, shared codebase size and savings are increasing.

If you want to develop your next app for both iOS and Android, and potentially other platforms in the future, consider React Native – it can help you save time and money.

--

Technical experts: Michał Mokijewski, Piotr Torczyński. Editing: Natalia Chrzanowska. Writing: Natalia Chrzanowska.

React-Native-companies
Project management app
READ ALSO FROM React Native
Read also
Need a successful project?
Estimate project or contact us