2022, A year spent in vain
Introduction
NativeScript's final harvest now gathered, today we tally the last fruits it had to bear and shall pour one final cup onto the field in respect. As we go to fill it, however, our attention is drawn by the glinting of tools in the distance, as acolytes can be seen still attempting to plough the icy fields. Defiant to the news that nothing more will grow in this barren land, we can but save a bottle for them, too.
The roadmap planned for 2022, although tragically never to be driven beyond, does cover all the ground it set out to. It is paved with plugins, documentation and infrastructure updates, and—through community efforts in integrations—even forms fresh new junctions with other ecosystems.
Come, as we survey the year's work.
The harvest
Prototyping (Preview and Stackblitz)
Preview, a prototyping solution allowing one to develop NativeScript apps in the browser, reaches version 2.0 and is now delivered through Stackblitz (an in-browser development environment). For users, it brings an improved editor (VS Code for web); a greater set of built-in plugins (from barcode-scanning to Google Maps); offline editing; shareable projects; and no end more.
Though as much, if not more, has improved on the infrastructure side. In the words of Igor Randjelovic, a man whose fingerprints adorn just about every NativeScript core repository, and the craftsman behind this work:
Infrastructure wise, it's a much much (much much much) - much much much much much much much simpler setup that's simpler to work on, simpler to deploy updates to, scales infinitely and it's way cheaper too...
To read more, see the announcement from August.
JS engine updates
Keeping the NativeScript iOS and Android runtimes up to date with the latest v8 JavaScript engine takes considerable expertise and effort, and both were due an update, with iOS beginning the year on version 9.2 and Android lagging behind on version 8.3.
With the minor releases of @nativescript/ios@8.5.0-beta.0
and @nativescript/android@8.5.0-beta.0
, both were brought up to v8 version 10.3.2 (equivalent to "Chrome 103" on the Chrome roadmap, dated 21st June 2022), resulting in significant speedups and a two-year leap forward in support for ECMAScript APIs.
Thanks to Azbouki and nStudio for undertaking this!
React Native native module support (Open Native)
React Native native modules are the jewel of the cross-platform world. They represent the richest ecosystem of native APIs abstracted into JavaScript, with over 1,000 libraries listed on the community-maintained directory.
Unfortunately, although these modules are written in JavaScript, they cannot be used in JavaScript runtimes like NativeScript (nor indeed Node.js, nor browsers) as they depend heavily on React Native and its CLI, resulting in a lot of duplication of effort across cross-platform ecosystems.
Enter Ammar Ahmed, no stranger to navigating undocumented React Native functionality as proven by his invaluable JSI guide, who joined the NativeScript community in August, bringing along an infectious passion that continues to invigorate the Discord chat rooms.
Setting out to bring React Native native modules to NativeScript, he got to work. As concept turned to proof with his implementation for Android, Jamie Birch (a certain newsletter writer) pitched in on the iOS and CLI fronts, bringing previous experience with implementing Expo Unimodules support for NativeScript. Soon, Nathan Walker got involved to streamline the monorepo workflow, and before long, everyone from the TSC to the community was taking an interest.
And from the forge emerged Open Native. In its short time, it has already helped several developers throughout the NativeScript community reuse existing work from the React Native ecosystem and deliver projects faster, a true triumph of asking "What if..?".
To read more about it, visit the Open Native repo or jump into the #open-native
channel on our Discord!
Standalone DOM implementation (DOMiNATIVE)
NativeScript's cross-platform abstraction (NativeScript Core) consists of several UI components originally designed to be used imperatively and/or with a XAML-like markup language. Integration with web frameworks was an afterthought, and so each "flavour" of NativeScript (Angular, Vue, React, etc.) has had to map those imperative APIs to DOM, generally taking a bespoke approach.
An expert in renderers (having made the novel ef.js), Yukino Song, arrived into the community in August to set things right. Her creation of DOMiNATIVE, a standalone minimum viable DOM implementation for NativeScript, enables the quick adoption of any web renderer.
Her work together with Ammar (focusing on TypeScript support) and Juande Martinez (focusing on Vue 3) have led to a Cambrian explosion of new NativeScript renderers (as well as bleeding-edge updates to existing ones).
Perhaps most exciting is the new Solid integration, which you can try out on Stackblitz!
Updates to NativeScript flavours
Each of the NativeScript flavours have continued firing the coals, with React improving installation experience (no more patch-package
), and Angular updating to support version 15. But the real star of the show is Vue, with Igor delivering its long-awaited update to version 3. With it brings vastly improved HMR and support for all the latest features.
SwiftUI and Jetpack Compose support
After years of native UIs predominantly being coded in an imperative style, the rise of SwiftUI and Jetpack Compose signals a new era in which native UIs may default to declarative, and libraries are increasingly being created with them.
Now, through the official NativeScript plugins for SwiftUI and Jetpack Compose, it is possible to use such UI libraries in NativeScript apps. Thanks to Valor Software for this integration!
Ionic Portals
Whether you want to reuse existing web code for a frontend (e.g. present a modal for signing in), or just plain prefer building UIs using web tech, Ionic Portals allow you to place a little (or big) web app anywhere into your NativeScript app. There's a lot to cover, so best to read the announcement for the full details.
Canvas
Osei Fortune, resident plugins wizard, continues to amaze with his ambitious integrations. This year brought the first stable release of Canvas, his suite of adapters for low-level graphics libraries (e.g. pixi
and three
) allowing one to create 3D experiences, games, and more.
Osei is always cooking something up, so expect to see more from him in further newsletters!
Onboarding and documentation
Providing a smooth onboarding process is of paramount importance to any cross-platform framework, and documentation is at the heart of it all.
This year, Igor has been hard at work overhauling the documentation with a stunning new website, writing tutorials for all flavours of NativeScript, explaining the many options for multi-threading, and more!
The initiative is taking off, with Ammar, Jaunde, Nandee Tjihero (you may know from her tutorial on how to use Java code in NativeScript) and Valor Software all getting involved as well.
Benchmarking
Using a JS-to-native framework brings a certain overhead compared to writing a purely native app that has long led to perceptions of the former being slow. The TSC wished to quantify what this overhead was in real terms, and whether the overhead was significant in practice.
For further insight, they decided to cross-compare with React Native, to identify any areas to improve upon (or conversely, to be proud of!). By enlisting the React Native experts Margelo, they could be sure that the benchmarks were sound on both sides.
The results, though, deserve more than spoiling here—for the full story, read part 1 of our blog series on performance!
A return to reality
All this, but for nought. As the chill air blows, a plough stalls in the field, and the cattle weary. Yet still the workers tarry on, possessed.
Won’t somebody please tell them: NativeScript is Dead?