Native? Hybrid? Web App?

Native? Hybrid? Web App?
Photo by Alexandre Godreau on Unsplash

Originally posted on Medium - 27th June 2018 - So this prediction didn't age well, we still don't have great PWA support on iOS, and we now have tech like Flutter which is working quite well also.

Where have we come from?

In the last ten years, since the iPhone was released, the nature of the web has shifted. Once we designed and coded with HTML for large screens, now it’s all about what’s in the palm of your hand.

When the iPhone first came out, there was no app store, all we had were web pages pinned to your home screen. Twelve months later, the app store opened. This gave us two big things. A new language to code in, and in many ways, more importantly, visibility. Around this time, Android also came on to the scene, so all of a sudden, if you were to develop something for a phone, you had to write it twice or just do your app as a website and deal with the limitations.

Early PhoneGap apps just didn’t look right. Copyright Kai Hendry — via Flickr

Along came the saviour. Being able to write your apps as web pages, then host them within a framework to get on to the app store. Unfortunately, none of these apps felt “right”. It was pretty obvious that they weren’t native. They were slow, didn’t look quite right, and some functionality didn’t operate the same way (for example, having to scroll iframes with two fingers, not continuing scrolling with friction when you released your finger, etc). They did give the benefit of device specific features however. Things like GPS, accelerometer, and later, push notifications.

Around this time, I was all in on iOS development. Teaching myself ObjectiveC and watching the amazing Stanford lectures that had been released. In my mind, there was no comparison. My superiors often brought up the hybrid notion (using PhoneGap — now known as Cordova), but I managed to convince them, that most users have a single device and expect their apps to work a certain way. You couldn’t just shoehorn iPhone ideas into an Android application.

On the desktop side of things, over the MANY years they have been around, things have jumped from being mainframe based with lightweight frontends, to heavy desktop apps, and then back (this time it’s called “The Cloud”). Phones on the other hand have gone through the same transition, but in a much shorter space of time.

Where are we at now?

The closest thing we’ve had, in the last few years, to a unified language for both platforms, which is fairly performant, would be React Native. It’s model of rendering with native components, but running JavaScript for logic has been a game changer.

The big change that made this possible was Apple opening up their more performant JavaScript interpreter to all applications, not just Safari. Something that Android has always had, but given that apps are typically developed for both platforms, the lowest common denominator had to be observed (much like way too many years of having to support IE6).

The future?

In iOS 11.3 we’ve had a similar transition (Android on the other hand has had this for a while). Service Workers are now open to all by default, this is the key component to a PWA (Progressive Web App). I can see things from here transitioning back to the web.

Progressive Web Apps in general feel a lot slicker than hybrid apps of the past. Copyright Jeremy Keith — via Flickr

PWA’s have all the advantages of apps (such as offline access) with the exception of being on the App Store. Unified look and feel seems much less important these days now that people have jumped back and forth between iOS and Android. Apps tend to have their own look and feel now even when developed natively.

In the last ten years, web browsers on phones have gone from bearable to actually quite performant. Just In Time compilation for JavaScript is a big part of that, but rendering engines have improved, plus just having faster CPU’s and GPU’s on our devices.

So where are we headed? I’m seeing PWA’s as the next big stage of apps, becoming more important than React Native. One of the big React Native supporters, Airbnb (check out their amazing and in-depth write-up here), have decided to drop support and go purely native. For a complex application like theirs, with lots of moving parts, this makes sense from a performance point of view. Most of us aren’t Airbnb, and our apps are much more humble.

So where do I sit on this? Native is where you go when you need to squeeze absolutely everything out of your device and PWA’s are for rapid development and release (think CI/CD pipelines to customers). PWA’s also have the advantage of using many more languages. Want to write in React, go for it. Want to use Angular, yep. Vue, sure. How about something more obscure, Elm for instance? No issues whatsoever.

So where does this leave React Native? Yes, you get the advantage of being on the App Store, but that’s about it. We’re swinging back to Web Technologies, so why not just do a web page wrapped inside an app with a web view? If security is a concern, you can always ship your pages with your app and inject them in to the view, not allowing any external web access. The downside to this is that you’re back waiting for approvals.

Now I don’t see React Native disappearing, but I do see less and less being developed with it. If you currently are developing for React Native, stick with it, unless it’s giving you grief, there’s no need to change. If you develop on React and feel the need to move to React Native (possibly for the same security reasons listed above), it shouldn’t be too much work to change, as long as you’re sticking with flexbox for your layout, they are developed to work very similarly. Going the other way, not too hard either for similar reasons.