Browser wars II: The iOS betrayal

React Native or Flutter are here to help you to create easily your App in iOS or Android (even web), using the same code and with an awesome performance. But there is only a little thing…

The Golden years

Before the smartphones, after the reign of desktop applications we met the golden years of Web apps, web 2.0 was rising, and we found the UI koiné : HTML5 .

If you wanted to develop an App for Windows, Linux, Mac and the first iPhone you wrote the interface in HTML and that works everywhere, HTML5 stole Java’s slogan: “Write once, run anywhere

The only thing you need to develop an entire app was literally a plain text editor

We left behind the hard part of the first browser war, yes, we had Internet Explorer 8 giving troubles, but jQuery helped a lot.
Browser fought for being the more standard compliant, they fought to add richer experiences, and, as always, they fought to be the fastest one.

In every device with a browser you had your app running, almos everywhere until…If you had a thing with a browser you browse your app there, and then…

The iOS betrayal

There was no app store on the original iPhone, It was meant to use HTML5 apps.

The web was perfect, this was the excuse to not have support for Adobe Flash, fighting for the standards they say.

When the App store came Apple realized it was a gold mine, they could have a cut of any app working on the iPhone through the only available app source: their store.

Suddenly the good old HTML5 became an enemy to destroy, why support web apps with no Store fee? Let’s begin the boicot:

  • No webWorkers until yesterday, and now very cripple one with limitations such as no push notifications, you can’t add the app to the list with a link, no touch id, no more than 50Mb, etc.
  • Forget a workaround using third party browsers, they are forced to use the iOS engine with this limitations.
  • For develop any app in iOS you will need an Apple device, just like that. You can emulate Android on Mac, but you can emulate iOS outside a Mac. You will need Xcode one way or the other.

Regulations do their part to damage web app UX. Ignorants Politicians forced every web site to put a cookie banner, instead of encourage private browser’s mode.

The false saviors

Oh gods! I wish to have something to code onces and deploy everywhere, web, iOS, Android, even desktop, with performance. Yes, the performance is the most important thing in your app, even if is a regular shop and your users will not notice the difference.

React Native

Using Javascript and React you will be able to deploy literally everywhere and with a theoretical performance 80% compared to native.

But to be honest this is a lie. You will make you choose between having a bad app on 3 platforms or spend 3x more time to have consistency between them. Two graphic examples to show that even the browser wars was a child game compared to the inconsistencies:

  • Styling
    • Overflow-visible you can position text outside a box in iOS and web, but not in android.
    • You will be forced to use css-in-js that generate crappy css files for the web. I will talk (badly) about css-in-js in the future
  • SVG (multicolor): iOS doesn’t support it, android and web does, you will have to install a plugin and face consistences.

You can read more reasons why is not a solution from former react native fan AirBnB here.React Native: using Javascript and React you will be able to deploy literally everywhere

Flutter

Google has money, React is from Facebook, let’s try to beat the React Native hype.

With Flutter you will code on Dart (wikipedia link here) and it will paint in a screen canvas your interface (less inconsistencies) and with great performance, they swear to get +15ms in rendering your kittens.

  • Who wants to learn Dart, manage yaml packages and flutter custom styling? Tell your devs to start learning Dart to master it only for Flutter, or even worst tell a rookie to start with Dart language. Let’s everyone to learn esperanto, it will be fun!
  • No web currently, create another app in HTML5 or wait to the experimental becomes alpha.

The silver bullet

XKCD nailed again

We want to have an App written with the same code, runs everywhere with UX consistency, with experience and support…what about HTML5? and you will only need a notepad and a browser to develop it.

If you (really) need performance to do some operations, first review your code and if this is not enough check out webassembly that offers up to 80% of native performance to make some heavy lifting. But really, check your code first.

If you need something like push notifications in your app, start small, give support to the good guys that don’t cripple the web: Android and Desktop. If your app has huge success and you need iOS support use a web wrapper like Cordova. I wish you luck to deal with Apple bureaucracy to publish your app.

And one last thing, web is open source, lots of developers has learned by right clicking the browser and inspecting the code. It was like open a hood of a car to see what was going on there. “How did this dev this that?”, “look he added this workaround to achive this effect”…

you can’t right click a native App

Rem + em, a love story

Not this REM but…

With the new times using javascript for everything on the frontend (React.js, Angular.js) CSS is targeting more and more modular coding.

This is why if you are progressing in CSS you should learn BEM naming conventions.

A common problem I found is the designer use REM units for everything (or even worst PX) because they fear if you use relative units it will be affected by the context, and they want the css rules to be as standalaone as they could. There is a mayor problem with this approach because if you create different sizes of the same component, or you want to change the layout you have to rewrite all the sized attributes. This means more code, more complexity, hard readability…

The solution is to use REM units in the parent and use EM in everychildren, so when you make only a big mediaquery in the body and it will adapt itself all the way down in the body.

Check out this example code I made in codepen.

[codepen_embed height=”265″ theme_id=”0″ slug_hash=”KqXbWr” default_tab=”css,result” user=”pikilon”]See the Pen <a href=’https://codepen.io/pikilon/pen/KqXbWr/’>CSS relative units in component layouting</a> by Pikilon (<a href=’https://codepen.io/pikilon’>@pikilon</a>) on <a href=’https://codepen.io’>CodePen</a>.[/codepen_embed]

 

Better bootstrap grid

Bootstrap is a great framework (if is in the right hands) and the grid system is one os the most used tools, but isn’t is very repetitive to write?

If your answer is yes you’ll like this unobtrusive bootstrap addon I made. Make grid faster, without writing “col-md-2” six times (in each column).

I add two more things: no-gap columns and a 10 columns based grid (using col10-*-* and .row.base10-*-*)

And you can see documentation and download the file in my github here
You have an example here

[codepen_embed height=”265″ theme_id=”dark” slug_hash=”vKBgJp” default_tab=”result” user=”pikilon”]See the Pen <a href=’https://codepen.io/pikilon/pen/vKBgJp/’>Bootstrap addon better grid (add it before the bootstrap library)</a> by Pikilon (<a href=’http://codepen.io/pikilon’>@pikilon</a>) on <a href=’http://codepen.io’>CodePen</a>.[/codepen_embed]

No more modals

Lightboxes, a modal windows, whatever… someone has to stop this.

Like the slider is something that is requested for almost any user interaction

Phones don’t respond well to them

Yeah this is a modal on my phone
Yeah this is a modal on my phone

You could end up cropping the window, making impossible to zoom in/out, or worst, the user hit “back” and it could leaving your site.

If you have an image use “open in a new window” link, saves time, css/js and the results are better.

link_new_window
Same page, same image but showing the jpg without modal.

 

Awful interfaces

I have seen 5 levels of modals, or generate one for things that can be solve with an “confirmation” prompt or even an alert.

More levels, more!

Try to use other UI like Tabs, slidedowns, when ever is possible it will be more friendly for the user. Very often the modal is a fast solution because we haven’t spent enough time thinking the right answer to the problem: where to put the form, where add some confirmation button, etc.

In conclusion: modals are the new 90’s Pop Up windows, are related with the annoying advertisement and should be use only if we need to shake the user and screen him “look here idiot, do what I told you”.