A question we often get is whether React Native or Swift is the better platform for iOS app development. Both platforms can be used to create excellent native apps that run smoothly on iOS, but they require different skill sets and resources to build. The framework you ultimately decide to use has both financial and technical implications for you and your team. So let’s dig in.
- Introducing the two platforms
- Third-party APIs
- Over-The-Air Updates
- Which Platform is best for complex enterprise apps?
- Finding developers for Swift and React
- Is it safe to build your app on an open-source framework?
- Are React and Swift HIPAA, PCI compliant?
- Choosing between the two
Introducing the two platforms
Swift is the official native app-building framework for the Apple family of products. It’s designed as a one-stop platform for building macOS, iOS, watchOS, and tvOS apps. It’s also Apple’s platform for future product development. It’s an upgrade from Objective-C.
Apple has developed Swift to make the most of its hardware. So the software is purpose-built to leverage all the power and capabilities that Apple hardware has to offer.
React Native is a cross-platform open-source native app-development framework for iOS and Android that’s owned and maintained by Facebook. The primary focus is on iOS and Android. As AppleTV is based on iOS, it’s also officially supported by React Native.
React Native was born out of necessity. Facebook had a problem, a big one. They were relying too heavily on HTML5 to create and deliver a cross-platform experience to their users. They had the right idea but the wrong framework. HTML5 was great but it was slower than native apps. As a result, React Native was created. It was the bridge they needed to deliver a seamless user experience across Android and iOS with a native look, feel and performance.
React has a very firm target – iOS and Android app development. Period. And unlike Apple, Facebook doesn’t control the hardware so it has to adapt its framework to the changing ecosystem.
This performance comparison is strictly based on iOS device performance. These results are combined from analyses drawn by John A. Calderio and Rakshit Soral in separate studies. The conclusions were reached by comparing data generated when using an identical app built with either Swift or React Native.
The app has 4 basic features:
1. A profile page which uses Facebook API to sign in.
2. To-do list where a user can add or delete tasks from a list.
3. Three blank pages.
4. A map that uses the inbuilt GPS on the phone to show a pulsating blue dot on the current location of the device.
The test was simple. They had to capture device metrics using Apple Instruments each time one of the 4 app features or functions was accessed. We’ll take a look at the results for CPU performance and memory allocation. We’ll also check out the app size.
Because the results from both experiments were similar, we’ve used images from John’s experiment to illustrate them.
React Native is the clear winner in memory allocation. Swift shows a huge spike in memory use when adding and deleting a task on the to-do-list as well as when the map is opened.
Swift has a slight advantage over React Native here. It is more efficient with CPU usage in this test by 17.58%. It uses slightly less processing power than React when viewing pages as well as when the map is clicked and the app looks for the device’s GPS.
It seems that while React Native is better at memory allocation, it offsets this by clocking in a higher CPU usage than Swift. While this is not a big deal for regular apps, it can be an issue for complex enterprise apps that need more processor power and speed. An example of a complex would be an app like Slack with multiple accounts open at the same time.
React Native apps tend to have a larger file size compared to those built with Swift.
In our experience, maintenance costs are 25-30% of development expenses. Between the two, React Native requires more maintenance work than Swift as updates for React Native are released more frequently. As a result, you may spend a bit more on maintaining a React Native app than one made using Swift.
It’s not unusual to have breaking changes, libraries and dependencies that need to be updated and tested at least once every quarter. The tradeoff here is that you can reuse the code on Android. But for an app that’s going to be purely iOS-based, it’s probably not worth the extra spend.
Support for third-party APIs
React Native and Swift both support third-party libraries and APIs. And, as mentioned above, due to the frequent updates on React, there is a constant need to monitor changes in compatibilities. This should be accounted for in terms of financial and time costs when deciding which platform to go with.
Over-The-Air updates are an important feature in the app maintenance and development process. They enable quicker bug identification and resolution. OTA updates allow you to push limited updates to your app without users having to download a new version from the App Store.
When a new feature is launched and it breaks your app, you can remotely fix feature without releasing a new build too. This spares you the trouble of having to roll back an entire version of your app in order to fix the problem. It also means you can deliver an enhanced user experience. Users can be unforgiving with their expectations. Always keep the user experience at the top of your priorities.
OTA updates give you the rare opportunity to launch a first stage MVP (minimal-viable-product) and then tweak it to perfection based on feedback.
CodePush, a Microsoft product, is the most popular OTA update platform. It supports OTA updates for React Native apps. All React Native apps created on Microsoft’s Visual Studio App Center have CodePush enabled by default.
Swift doesn’t support CodePush.
Which platform is best for building complex enterprise apps?
Without a doubt, Swift. It’s optimized to make the most of Apple hardware and has less frequent platform source code updates. As such, complex enterprise apps are best written in Swift. Technically speaking, there is nothing that can be done in Swift that can’t be achieved with React Native. But as we get into the weeds of an app with hundreds of screens, React can potentially “make something that would be trivial in native very difficult.”
The platform is new and not as mature as Swift. It changes very rapidly and things break easily and fast.
Let’s take a look at an interesting example. Airbnb adopted React Native in 2016 just after it was launched. They were one of the earliest Silicon Valley adopters and built up to 880 screens in React Native, with numerous third-party integrations. But after only two years, they decided to sunset React Native in 2018 because they felt the platform was immature and it didn’t work well for their app and numerous integrations.
The truth is, while their developers found it easy to learn React Native, they also found it difficult to debug because of the rapid change. Eventually, they decided that working with native platforms like Swift was more economical and sustainable for their business.
If you’re a founder of an early-stage startup, just be aware that you may have to rewrite the technology later on into a mature platform like Swift, but by then you’ll have a very different runway to invest into the transition.
Finding developers for Swift and React
There are more developers for React Native than Swift. This gap in the market makes hiring a Swift developer more expensive than one for React Native. So if you want to build your own team of developers to manage your app after it’s been built, it’s more practical for you to go with React Native.
Is it safe to build your app on an open-source framework?
Yes, so long as you know what you’re doing and have the right resources. Open source doesn’t equal unsafe. In fact, it may even prove to be better because the platform can support functions that Swift doesn’t due to proprietary issues. Also even though React Native is open source, it’s owned by Facebook. They have every reason to keep it current.
React Native has a very large and active community of developers all over the world who are not shy or slow to sound the alarm when something goes wrong. For example, in 2017 Facebook moved to change the React Native license to include protection for their patented functions. WordPress, immediately announced they were pulling the plug on React Native for their Gutenberg update.
WordPress controls a quarter of all websites on the internet. Many other React Native developers also protested the action taken by Facebook. A few days later, Facebook rescinded its decision. The React Native community’s voice is strong. Facebook can’t pull the plug on React Native easily. That type of activism in the community makes the platform safer. Apple, on the other hand, is known to be a stickler for not listening to developers as far as proprietary functions are concerned.
Are React and Swift HIPAA, PCI compliant?
Swift and React Native are just platforms. They don’t need to sign a BAA in order to be HIPAA compliant. It’s how you build your app that makes it compliant. Whether or not you use either will not affect the HIPAA compliance status of your app.
As far as security is concerned, both platforms can be configured to provide very high and equivalent levels of security for your users. You can even make use of hardware such as FaceID and fingerprint recognition.
Choosing between the two
When deciding which platform to use, it all comes down to what you want to achieve. You won’t be able to tell the difference with the naked eye between a React Native and Swift app. So, here are some variables for you to consider:
- If you are building an app that you intend to extend to the rest of the Apple family of products, Swift is the platform of choice.
- If you are building an app that you might need to extend to Android in the future, then you should start off with React. This will save you the headache of having to start from the very beginning all over again.
- If time to market is your primary concern either of the two platforms is fine.
- If being able to find a team of developers is a potential challenge, then React Native is your favorable option because there are more React Native developers than there are for Swift.
As you can see, there are various scenarios that will determine your decision – both financial and technical. Take some time to look carefully at your project before making the leap.
Not sure which platform you should use? We can help. Book a complimentary App Strategy Consultation session with us valued at $300 here.