One of the big challenges that NativeScript is designed to solve is the code sharing between iOS and Android projects. Meaning you can build mobile apps with JavaScript/TypeScript or Angular, which use the same code for both platforms. However, the marriage of Angular with NativeScript allows us to take it a step further, which is the code-sharing of the NativeScript and Web applications.
With the combination of NativeScript and Angelar’s platform-agnostic architecture, we are able to use one shared codebase to create a native iOS, native Android, and web app from one source.
Read about how UGroupMedia created their popular Portable North Pole app with a similar code-sharing strategy for iOS, Android, and Web.
This requires two parts:
A code-sharing ready project structure – enabling you to have both platform-agnostic (shared) and platform-specific code in a clear and intuitive fashion.
A build process – capable of using both shared and platform-specific pieces of code and building your mobile and web apps.
Beautiful, accessible, platform-native UI – without WebView. Define once and let NativeScript adapt to run everywhere, or tailor the UI to specific devices and screens. This is one of the reasons SAP chose NativeScript.
Angular has been around for a few years now and since its release, it has been useful when creating many different categories of applications, including web as well as mobile. The problem, at least for me, has always been that the experience for creating these various applications has been inconsistent and often confusing even though the driving technology has always been the same.
Things have gotten better now that custom schematics can be used with the official Angular CLI. So, what does that mean for us? We can take a project created with the Angular CLI, add a schematic, let’s say for NativeScript, and end up with CLI compatible for both web and mobile.
We’re going to see how to use the Angular CLI to build a web and mobile compatible application with the NativeScript schematics.