Native vs. Cross-Platform Mobile App Development
By: Ethan Campbell
Are cross-platform mobile app development tools worth the hype over native development? It’s true that developing apps natively lets you work with a high level of craftsmanship and community support. However, for most common app requirements, you can use platforms like Xamarin, React Native, and NativeScript to build apps cross-platform with only minimal loss of user experience (UX) while saving time and cutting costs.
To help you determine which option is right for you, we’re going to take a closer look at the functionality of cross-platform frameworks and see how they stack up against native. Then we’ll take a look at UX/UI considerations for your app. Finally, we’ll discuss how the team at Aptera decides when to use native and when to use hybrid solutions for developing mobile apps.
Most any device function offered natively can now also be leveraged in a hybrid solution.
At this point, Xamarin, React, and NativeScript all claim 100% support of native functionality through their APIs. Additionally, NativeScript and React also supplement their platform shortcomings with third-party plugins and support for Cocoapods and Maven.
React Native supports native functionality through what it calls modules. Not all native functionality is supported via a module, but there is the option to include any native code (Java, Swift, Obj-C) via native modules. Native modules are considered an anti-pattern to the framework, however. Most native functionality support can be found in third-party libraries too, however, its unclear how easy they are to use and if they even follow similar conventions to React Native itself.
Developer Effort Requirements
The chart below demonstrates the effort required by developers to implement the following features/functionality in each platform based on ease of implementation and developer support.
Developer Experience Quality
This chart depicts the developer experience by category with green representing a high degree of quality, that’s well-documented and fast.
Hybrid development frameworks target only a specific set of platforms. Xamarin is able to target iOS, Android, Windows, macOS, and Linux with other smaller platforms also supported and more on the way. React Native and NativeScript are limited to only iOS and Android.
Native development is limited to a handful of integrated development environments (IDEs) specifically designed for each, with Android Studio as the preferred tool for Android and Xcode or AppCode for iOS. With Xamarin, Visual Studio is the only option on both Windows and Mac. React Native and NativeScript apps can really be written using any text editor preferred since they are CLI driven, but the community generally steers towards Visual Studio Code as it contains a healthy library of supporting plugins. It should be noted that developing iOS apps requires a Mac and Xcode no matter which option is chosen.
Native IDEs and tools will always offer the best, fastest, and most thorough support of debugging and profiling apps. Most of the hybrid frameworks support deploying to physical devices, debugging/logging errors, live coding updates, and profiling. It should be noted that the performance and simplicity of doing so is not as straightforward when developing in native.
The community is larger for native platforms because they are the originals! Customizations through third-party tools, questions posted in forums, and updates to the platforms themselves are more abundant natively. While large communities do surround each open source, cross-platform framework, the reality is that they will not match the support that native gets.
All frameworks support testing through unit or automated UI tests. It should be noted that native development will require you to write the unit tests twice for each platform. For automated UI tests, there are testing frameworks that target one platform or framework (native iOS only, native Android only, Xamarin only, React Native only, etc.) and other frameworks that allow you to perform those tests in a cross-platform way no matter how it was developed.
Native platforms support third-party customizations through Cocoapods and Maven. Xamarin does not include support for these. React Native and NativeScript offer support for native libraries, however with a varying amount of increased difficulty over native.
Reuse of Logic
Logic written in one native platform cannot be reused on another without introducing some server-side backend to host business logic. Logic written in C# and Xamarin can be reused across projects and can even be packaged up into a Nuget. React Native allows reuse of logic when it is written in React. Likewise, NativeScript allows reuse of logic when written in Angular.
All frameworks can take advantage of native styling and theming concepts and understanding native styling at its core is a good starting point. Xamarin leverages XAML styling definitions (locally or globally). Most of the basic styling concepts are honored; however more fine-tuned styling requires custom effects/renderers to be implemented natively. NativeScript leverages CSS styling. There is no new terminology to learn as a large portion of CSS properties web developers already know can be used. CSS files can be split into common and platform specific files to provide another level of customization.
UX/UI Design Considerations
Cost savings by leveraging shared code are only realized when designs are simple enough to not require platform-specific accommodations to be made for UI designs and functionality. In situations where a rich, beautiful design is required with smooth animations, scrolling, and/or transitions, it may be more economical to leverage the deep repository of native libraries offered by the much larger native open source community. That said, a simple design can be quickly constructed with out of the box Xamarin, React Native, or NativeScript tools.
Development Effort by Platform
This chart visually displays the increase in development effort with many platforms as the design complexity of your app increases.
Which Platform Do We Choose?
The native vs. cross-platform question mainly boils down to design complexity / UX, whether or not a project needs to leverage existing BL, and which tools best suit the development team while accomplishing the project goals. However, there are a few hard guidelines that are strong indicators of which stack to choose. See chart below.
Platform Interest via Google Trends
About Ethan Campbell
Ethan is a Sr Software Engineer for Aptera Software, specializing in mobile technologies. He has been developing enterprise solutions since 2000. As an avid mobile development enthusiast, he loves to study new mobile technologies, languages and industry trends.