If you’ve been keeping up with my content since the birth of The Polyglot Developer, you’ll know that I was once a huge advocate of Apache Cordova development using frameworks like Ionic Framework. Having been a web developer and coming from native Android development with Java, cross-platform development using hybrid technologies seemed like a logical next step. Fast-forward to now, I’m no longer using Apache Cordova with Ionic Framework and have gone back to native development.
I recently came across an article by Ionic’s CEO, Max Lynch, titled, Cordova/Ionic Apps are Native Apps, trying to explain that Ionic applications are native mobile applications. There are some valid points made in this article, but as someone who spent several years using the technology as well as using applications built with the technology, it is not something I agree with as a whole.
Let me start by saying that I actively develop mobile applications, using various programming technologies and frameworks, some of which have even been released to iTunes and Google Play. There are benefits when it comes to developing with either a native framework or a hybrid web framework. The purpose of this article is not to tell you which road to travel, but to educate you on what Apache Cordova and Ionic Framework is not. Like Max’s article, this one will be opinionated as well.
A core point that Max tries to convey in his article is that the packaged Ionic applications use native components in Android and iOS, thus making them native. I have metal screws in my body, so can I tell people I’m a cyborg? To package an application that can be installed and listed for distribution in the app store, it needs to have the bare essentials. The bare essentials, in the case of Apache Cordova and Ionic, is a native webview.
We’re running in a native app, we’re just doing a lot of work in that pesky UIWebView.
Yes, the UIWebView is a native component for iOS. If you tear down the build, you’ll see a bunch of Objective-C files. If you’re a good marketer, you can sell applications built inside a webview to developers as a native application, but when only a very small percentage of the application is a native component, it is difficult to justify it being a native application.
Building an entire application within a webview may be slick and easy, but it does not come without penalty.
The thing is, webviews are slow to process things. They were slow five years ago and they are still slow. Trading native UI components such as NSButton for an HTML Button seriously affects performance. Android and iOS were optimized to process and render these native components, not what was found inside a webview.
It’s not a native app unless the app uses the stock controls Apple blesses.
I don’t find this statement to be true. There are plenty of developers creating custom components for Android and iOS. Take for example, the custom signature pad component for Android. This custom UI component extends native Android components to make things possible. The difference here is that it extends a native component rather than uses a native component.
It’s okay because it draws rectangles on UIView instead of drawing rectangles on a div in a web layer?
One or two rectangles aren’t going to make a difference where or how it is rendered. In the long run, Android and iOS knows how to better process the native components, not what’s crammed inside the webview. Anyone heard of Crosswalk for Android? Some versions of Android have a webview so terrible, that it is often unusable with Ionic applications.
This is where things get interesting. Ionic and Apache Cordova applications can gain native features that exit the webview through the use of a plugin. These plugins are Apache Cordova wrappers that wrap native classes and libraries in a way that Apache Cordova applications can understand.
Does this make the application native? Well, it depends on how it is being sold to developers. I prefer to think that we’ve now got a hybrid web application with native features, rather than a native application.
Max Lynch had written another article on the topic of plugin creation titled, How to Write Cordova Plugins. While possible to create plugins with native features, they aren’t always easy. You certainly can’t reference native classes directly in your application without a plugin. If you can’t access native features directly, is it still a native application?
At the end of the day, how you develop a mobile application doesn’t matter. The final result that you ship to users is what matters. When I download applications from Google Play, as long as the application looks good, performs well, and gets the job done, I keep it on my device.
To end users, a native app means they can find and install the app in the App Stores. They can run it on their phone instead of opening a browser. The app works offline, stores their login session, can take pictures and do things that Safari just can’t yet on its own.
I recently got into Bitcoin and started using BitPay. It is an attractive application, but it is slow to do anything from animations to basic functions. After having done some research I learned that it was created with Ionic Framework. When I downloaded the application I had no idea it was an Ionic Framework application until I started to dig around, but it got me thinking about why I dropped Apache Cordova development for my own applications.
The applications I was developing for iOS and Android with Ionic Framework were slow even though they weren’t doing much. Coming from high performance native Android development with Java, this was no good.
When a user, often non-technical, gets a bad application, they are only going to see it as a bad application and review it as such, regardless on how it was developed. The catch here is that some of the fixes to make an application good are going to require more than what a webview or plugins can offer.
Does this mean you can’t use a webview with these frameworks? You can use a webview and there are circumstances where you might want to, but at least your entire application won’t rely on it.
Depending on how you look at an Ionic Framework application, it could be considered native, but I wouldn’t call it that. You’re developing mobile applications that use native features with web components which make it better suited to be called hybrid web development.
To end users, “hybrid” apps like those created with Cordova/Ionic are native apps. Why are we so afraid to call them that?
While not impossible to make a bad application using pure native or a native framework, it is much easier to create a bad application with a hybrid framework. For as long as Ionic Framework hybrid applications reside in a webview, developers should feel embarrassed to say their Ionic Framework application is native.
Stay up to date on the latest in web, mobile, and game development, plus receive exclusive content by subscribing to The Polyglot Developer newsletter.