NativeScript 8.9 introduces significant enhancements that streamline development and improve performance. Here are some that catching my attentions and you should know too:
- Node-API Enabled Engines: Public preview of engines like Hermes, QuickJS, JSC, and V8. This upgrade enhances performance and reduces app size.
- New CLI Commands: The
ns widget ios
command simplifies iOS widget creation, whilens publish ios
facilitates effective application deployment. - Tailwind CSS Integration: NativeScript 8.9 supports Tailwind v4, allowing developers to leverage modern styling techniques easily.
- Enhanced iOS and Android Support: New capabilities such as Android’s 16 KB page size support and improved source code management with NativeSource config.
These updates position NativeScript as a robust choice for both production and hobby projects, fostering a community eager to explore its potential in mobile app development.
1. Node-API Enabled Engines – Next big thing!
NativeScript 8.9 introduces Node-API enabled engines, which significantly enhance application performance. The main benefits include:
- Improved speed: Applications can execute tasks more efficiently, resulting in faster load times and smoother interactions.
- Better memory management: Some engines optimize resource usage, contributing to lower memory consumption during runtime.
Supported engines include:
- Hermes: A lightweight JavaScript engine optimized for React Native, known for its fast startup time.
- QuickJS: Offers a small footprint and supports modern JavaScript features, making it suitable for resource-constrained environments.
- JSC (JavaScriptCore): The engine behind Safari, providing robust performance and compatibility with web standards.
- V8: Google’s high-performance engine is widely used in Chrome and Node.js, delivering excellent execution speed.
Although this sounds awesome, this feature is still very experiement. You are recommended to test your app throughful to make sure everything is still working as expect after changing the under Engine.
2. ns publish ios
is now back!
The ns publish ios
command allows developers to easily publish their iOS applications. This command includes the latest build tooling and documentation updates, making it simpler to manage app releases. Benefits include improved build processes and integration with existing workflows, ensuring that your apps are up-to-date with minimal effort.
3. Tailwind V4
The integration of Tailwind v4 with NativeScript 8.9 introduces a wealth of features that streamline the development process:
Key Features
- Utility-First Approach: Tailwind CSS emphasizes utility classes, allowing you to compose custom designs directly in your markup without leaving your HTML.
- Customization: Easily tailor Tailwind’s default configuration to suit project requirements, ensuring consistent branding across applications.
- Responsive Design: Built-in responsive utilities make it simple to create adaptable layouts for various screen sizes.
Benefits for Developers
Benefits for developers utilizing @nativescript/tailwind include:
- Faster Development: The utility-first paradigm enables rapid prototyping and reduces the need for custom stylesheets.
- Reduced CSS File Size: Tailwind’s purging capabilities optimize file size, improving load times and performance.
- Enhanced Collaboration: Designers and developers can work more efficiently together with a shared language for styling.
The enhancements in Tailwind v4 empower developers to create visually appealing applications while maintaining efficiency and performance.
4. Enhanced iOS and Android Support
iOS Widget Creation
Creating iOS widgets has never been more accessible with the capabilities introduced in NativeScript 8.9. The process involves utilizing the new ns widget ios
command, which simplifies widget development significantly.
Steps to Create iOS Widgets:
- Initialize a new project using the NativeScript CLI.
- Execute the command:
ns widget ios
to scaffold your widget. - Customize the generated files to fit your application needs.
Use Cases for iOS Widgets
- Quick Access: Widgets can provide users with essential information at a glance, such as weather updates or upcoming calendar events.
- Interactive Features: Allow users to perform actions directly from the home screen, enhancing user engagement and accessibility.
With these advancements, developing engaging and functional iOS widgets becomes seamless, empowering developers to enhance application functionality in innovative ways.
Android Enhancements
NativeScript 8.9 introduces Android 16 KB page size support, a crucial enhancement for developers targeting modern Android applications. This feature optimizes memory usage and improves performance, especially for apps with large data sets. The implications of this support include:
- Improved loading times
- Enhanced user experience
- Efficient resource management
In addition to page size support, version 8.9 brings significant Quality of Life improvements to the Android platform. These enhancements streamline the development process, allowing you to focus more on building features rather than troubleshooting build issues. Notable improvements include:
- Updates to NDK 27 for better compatibility
- Enhanced debugging tools
- Optimized build processes
These advancements position NativeScript as a top choice for both production apps and hobby projects, ensuring that you can create efficient and effective Android applications with ease.
Improved Source Code Management with NativeSource Config for iOS native code
In the past you used to have to put your iOS native code in App_Resources/iOS/src
. It is now more flexible as we now have a NativeSource config in your nativescript.config.[ts|js] file. This allow more powerful way to manage your iOS source code placement within NativeScript 8.9. This configuration allows you to define where your source files are located, enabling greater flexibility and organization in your projects.
Example:
// ...
ios: {
NativeSource: [
{
name: 'ProjectPlatformSrc',
path: './src/**/*.swift'
}
],
}
Multi-target Support for Swift Packages
NativeScript 8.9 introduces enhanced capabilities for managing Swift Packages within your projects, significantly improving flexibility and organization. The integration of multi-target support for Swift Packages allows developers to define configurations tailored to various targets directly within their nativescript.config
file.
With these enhancements, developers can easily manage multiple targets, leading to improved project structure and greater control over dependencies. The new capabilities not only enhance productivity but also pave the way for more robust application performance across different environments.
Updating to NativeScript 8.9
Make sure you have Node 22.12.0 or higher before proceed. Then use npm to update your nativescript cli to latest version with:
npm install -g nativescript
You can confirm the latest installed with:
ns -v
To migrate your existing project to 8.9. You can run the following in your projects:
ns migrate
Project dependencies should now be all updated. Also, please don’t forget to ensure your project is clean:
ns clean
Here are how your dependencies should look like after a successful migration:
"dependencies": {
"@nativescript/core": "~8.9.0"
},
"devDependencies": {
"@nativescript/android": "~8.9.0",
"@nativescript/ios": "~8.9.0",
"@nativescript/types": "~8.9.0",
"@nativescript/webpack": "~5.0.0"
}
Conclusion: Embrace the New Features of NativeScript 8.9!
Exploring these functionalities can elevate your projects. Engage with the community by sharing feedback on your experiences. Your insights help shape future developments, ensuring NativeScript remains a preferred choice for both production and hobby projects.
Above were the most interesting things that catched my eyes. For full details for what’s new in the version you can read the NativeScript official blog at: https://blog.nativescript.org/nativescript-8-9-announcement
Embrace the opportunities that NativeScript 8.9 offers and enhance your applications today!