Intro to Cross-Platform App Development
Whether your company is creating a mobile application for the app stores or for use internally, you are often faced with the challenge of needing to develop it for multiple platforms. Typically, this means targeting both iOS and Android devices.
Unlike the early days of the "smartphone" era where many developers only targeted a single platform, market research today shows that the U.S. consumer market is about 47 percent Apple and 52 percent Android. As a key decision-maker or developer, how do you solve the problem of creating your mobile application for both of these platforms?
For some, their company has the budget and resources to have two developments teams, each programming in the native environments for the platform. While developing in each platform’s native tooling does give you the advantage of being closer to the platform, it comes with a cost.
Yes, there’s the actual cost of hiring native developers from a smaller pool of talent, but, more importantly: Neither code base you’re building with is sharable. Whatever code the iOS team develops, cannot be reused by the Android team and vice-versa. You now have two separate code bases in existence, which must be individually maintained. So, if there is a change to the business logic or design that runs within your app, your company now must update and test both code bases for this change.
Beyond that, there is the added challenge of keeping the user experience aligned across each platform. While you should follow the platform-specific user experience patterns, you still want to the ability to provide custom touches to your application. Again, more work must be repeated.
Analyzing the Structure of Your App
Now, step back for a moment and look at the core structure of your app. What is it made of at a component level?
A header, that contains a title, some actions buttons. Probably a list of a few actionable items like form elements and buttons, and maybe a tab bar or a side menu for navigation controls. At the core, fairly stock and common user interface components.
Take another moment and inventory of some the most used apps on your phone, and I would expect that you can boil them down to a standard collection of components as well, like… buttons, toggles, inputs, list, etc.
So, if we can deconstruct our application into these core components, why should we have to code them more than once?
This is where cross-platform development frameworks, like Ionic, can provide a solution for many developers.
Let's look at that earlier application we broke down, but see how it could be built using Ionic's web components:
<ion-icon slot="icon-only" name="information-circle" (click)="showAppInfo()"></ion-icon>
<ion-label position="stacked">User Name</ion-label>
<ion-button fill="clear">Forgot Password?</ion-button>
<ion-checkbox slot="start" checked="true"></ion-checkbox>
<ion-button expand="full" color="primary">Sign In</ion-button>
Ionic can then take this markup and, by using its CSS, is able to render it according to each platform's UI guidelines. Here is what this markup will look like on both iOS and Android.
From one code base, you can produce applications that look and feel truly native on any platform. Look closer at these two images, and you will see that the icons are platform-correct, the fonts are different, the input controls reflect the default UI guidelines as well. This was done with no changes to any of the default theming.
Next Steps Using Ionic
Another advantage of using Ionic’s UI components is since they are built atop web standards, your team can leverage their existing web development skills when building their applications. This allows for greater flexibility for your team’s growth: Instead of being locked into a single platform, they can continue to leverage and expand their technical skills.
Some developers do not want to use a web-based solution, fearing that they will be limited by the capabilities of their user’s mobile browser. While more features are becoming available in our browsers, they are no match for all the capabilities that can be addressed by using native interfaces. To solve for this, both Capacitor and Cordova have a plugin scheme, allowing you to use third-party plugins that give you access to a wide range of native code libraries. If your application needs a barcode scanner, you can add the plugin into your project and interact with it directly from a single code base.
All that said now is a great time to explore the Ionic UI framework to see how it can reduce your company’s development time and costs while creating applications for iOS, Android, Progressive Web Apps (PWAs), and more.
Curious about other cross-platform approaches and how they compare to Ionic? We’ve also written a guide that dives deeper into the different cross-platform approaches: Hybrid-Native vs. Hybrid Web vs. Native. You can read more about the native layer of this type of approach here and don’t miss the “cheat-sheet” comparison grid at the bottom of the linked article to review the highlights of each type of app development.