By Reinder de Vries, founder of LearnAppMaking.com
Remember Adobe Flash? It was the ultimate cross-platform development tool. Flash ran on any web browser or operating system — it could even run on early versions of Android. And then came HTML5, that did many of the things Flash could do…
Cross-platform development has long been the holy grail of building software. Most cross-platform development tools promise you can build your codebase once, and then run the app on any platform. Why build natively for every different platform, if you can build it once and deploy on as many platforms as you want?
In this article, we’ll take a flight through some of the new and established cross-platform tools. The goal is to inform you about the different available options for cross-platform app development in 2019.
[Whichever platform you choose, make sure you’re using a strong analytics tool to quickly find and fix any bugs or crashes without having to hunt through code. Start by checking out a free trial of Appsee, which records and replays crashed sessions in real-time.]
Let’s get started!
And that’s exactly where most cross-platform tools get in trouble. Take for instance a smartphone’s camera. The code you need to use that camera is different for iOS and Android. In fact, the programming languages you use to create native apps on those platforms — Swift and Java — are 100% different.
PhoneGap solves this problem by giving you a unified approach with web technology that has a native look and feel. It looks like a native iOS or Android app, but it isn’t.
Tools like PhoneGap also provide unified APIs to interact with hardware such as the camera, media library, file storage, and GPS. Their underlying code may be different between platforms, but the way they work are very similar. On top of that, tools like PhoneGap allow you to access platform-specific code by using plugins.
Xamarin, now owned by Microsoft, is a cross-platform development tool that lets developers build native iOS and Android apps with the C# programming language. Xamarin apps are compiled ahead-of-time, which means they don’t suffer the performance drawbacks that interpreted or web-based tools have.
The Xamarin platform is a good example of the perhaps single greatest benefit of using cross-platform tools: developers can use a programming language they already know. C# is a programming language originally developed by Microsoft within its .NET platform. Developers familiar with the Microsoft environment for building software, such as C# and .NET, can easily pick up Xamarin development because the tools are virtually the same.
Xamarin apps are compiled, which means they run directly on a smartphones hardware and not in a web view. C# code is shared between native platforms, which means that most of the app’s code can be written once in a single programming language. And Xamarin apps also have access to native APIs directly, which means developers can use platform-specific frameworks like iOS’s ARKit.
A recurring theme in cross-platform development is “code once, deploy twice.” Can you really share 100% of the codebase between platforms? Depending on the complexity of the app you’re building, you can. React Native and Xamarin in particular have perfected the principle of the shared codebase, without the typical performance bottlenecks.
If you’re investigating cross-platform tools with the goal of building a cross-platform app, keep in mind that there’s always a chance that you’ll need to write platform-specific code. This means you’ll need native iOS or Android developers on your team, albeit not full-time.
Flutter, built by Google, takes cross-platform development to a new level. It was first released in May 2017, and its first stable 1.0 release was made in December 2018.
Flutter is on the bleeding edge of cross-platform development, and it deserves special attention. It’s so close to the “code once, deploy twice” phenomenon, by completely sidestepping the native platforms. And it’s quickly gaining speed in the developer community.
A particularly interesting feature of Flutter is called Hot Reload. With Hot Reload, changes to the source code of an app can be directly injected at runtime. It’s like reloading a web page, without needing to recompile the entire app. Hot Reload also retains the state of the app, so you can code and interact with the app at the same time.
Similarly to other tools, Flutter provides shared code for platform-specific features such as Android’s and Apple’s UI design, as well as the option to build platform-specific plugins. Platform-specific APIs and SDKs can be used natively.
In its own way, Adobe’s Flash could have been what Xamarin, PhoneGap, Flutter, and React Native brought to cross-platform development. We’ll never know if Flash was too early, or simply too late.
There’s a reason Flash is part of this cross-platform development story. Development tools are bound to change, as new concepts and paradigms rise in popularity, and others fade away. Who knows what cross-platform development tools get launched in 2019, 2020, and onwards?
As these tools get more advanced, the “code once, deploy twice” holy grail gets closer. Perhaps one day, we can really build an app once, and run it anywhere.
About the Author
Reinder de Vries is a professional iOS developer. He teaches app developers how to build their own apps at LearnAppMaking.com. Since 2009 he has developed a few dozen apps for iOS, worked for global brands, and led development at several startups. When he’s not coding, he enjoys strong espresso and traveling.