DEV Community

Discussion on: The different tech strategies to building a cross-platform app

Collapse
 
nathanwalker profile image
Nathan Walker • Edited

Thank you for updating to clarify that point much appreciated. With web/mobile sharing NativeScript is just TypeScript driven so you can share as much as you’d like to achieve best result on the target platform. Since NativeScript is just JavaScript there’s an immense amount of code you can share to drive both web and mobile tailored UX. Don’t believe I’ve ever heard of anyone putting a PWA into a NativeScript app’s webview. I would also recommend combining NativeScript with Ionic Portals if one was going that route ({N} being inherently flexible works with everything on your list):

Hope that helps bring more understanding to a great breakdown.

Thread Thread
 
redbar0n profile image
Magne Playful Programming

Thank you for your insights!

If you want a cross-platform app that shares as much code as possible between iOS + Android + Web, how would you ideally go about it with NativeScript?

I updated the section on NativeScript with some options, as I see them, after doing a bit more research into it. It's still not entirely clear what the best cross-platform strategy with NativeScript would be. I think I'm still leaning towards a Web View, since it would allow running most of the same code on both native and web..

Thread Thread
 
nathanwalker profile image
Nathan Walker • Edited

The degree of flexibility possible with iOS+Android+Web without compromises is the core reason I became interested in NativeScript many years ago (I personally didn't pay attention to the marketing of it -- what it was under the hood is what interested me the most).

Regarding cross-platform strategy with NativeScript + web development, the key part about this technology is it aims to be just natural JavaScript development, meaning all the same strategies you would use to share TypeScript/JavaScript code apply. This is a large topic with tons of options (and opinions) but the NativeScript TSC provides, as a starting base, some suggestions to frame a good fundamental understanding in terms of best practices:
docs.nativescript.org/code-sharing...

In short, any monorepo strategy is great for TypeScript driven "shared" (aka "code sharing") developments. Npm workspaces, yarn workspaces, Nrwl Nx, Turborepo, Microsoft Rush, the list goes on and on.

To expand on this with even more fine grain guidance, nStudio (professional software services), provides a whole set of tooling, simply called "xplat", aimed at enhancing Nrwl Nx specifically for diverse cross platform developments. It could also be adapted to work in any other monorepo tooling as well.

To answer your question, "not entirely clear what the best cross-platform strategy with NativeScript would be"... Here's some helpful information on xplat, which provide generators to get teams off the ground with a set of best practices for diverse "cross-platform" developments. This approach has been put to use successfully for several years and continues to be used to scale large TypeScript driven projects (enterprise and consumer facing):

There's quite a lot of work going on around NativeScript which continues to open up desirable workflows for TypeScript/JavaScript driven teams. On the inverse side, interestingly, some of the more recent work explores powerful workflows for purely native teams (Swift, Obj-C, Kotlin, Java) to work hand-in-hand with web teams to make use of diverse talent working better together without cornering teams into one style to bring ideas to life.

To conclude for me personally, the reason I'm attracted to NativeScript and enjoy working around it is it's ability to open up all the options on your list with angles to make them work together without cornering one out. I love technology and want to be working with all innovation at all times or, at a minimum, at least be able to, without inherent barriers from the get go; which is why I'm a fan of everything on your list -- I can work with it all by taking advantage of NativeScript.