NativeScript 5.2 offers a wide number of fixes, and is well worth upgrading to. Checkout what has now been fixed and/or enhanced in this awesome release from the NativeScript team.
One of the more interesting things for iOS is the In App Podfile and Src code support. Drop your any src code into the /App_resources/ios/src and/or a
Podfile in /App_Resources/ios and your app will automatically build it with your app. So you don't need to create a plugin to test or embed things in your app anymore. Plugins still are good for reusable code; but sometimes you might just have a simple function or Podfile that you just want added to your app.
Important Depreciation Notice
In version 5.2 short imports have been depreciated; I do not know when they will no longer actually work; but basically things like require("http") are no long valid; you need to do require("tns-core-modules/http"). The primary reason for this is that webpacking requires the full path; and it has problems with short imports.
The core modules offers the following enhancements and fixes...
Dialog now supports Decimal type
ImageCache now has onError exposed
onDiscardedError now officially in the typings
Android model fixes
iOS Flat Actionbar fixes
Password hint support
Multiple crashes fixes
Upgrade to V8 7.1.302 - which offers
- Stable Sorting
- More bytecode embedded saving 200kb of memory per engine.
- Escape analysis improvements (up to 40% faster)
- globalThis support
- Intl.RelativeTimeFormat support
Android X support
Ability to free Java memory that is being retained by a JS object
Gradle 3.3.1 support.
OnDiscardedError handler now works properly.
Can now manually free OBJC memory that is being retained by a JS object
Can now call ObjC methods with the same name but different parameters. (I've ran into this bug myself -- woohoo!)
GC tuning parameters
JSC tuning parameters
Fixes in Exception handling
Memory allocation fixes
In App Podfile and native Src code support
Node 11 support
Angular HMR support (finally fully working!)
--debug-brk on iOS should be working again.
Unit testing should work on Android again.
Fixed High CPU usage issue.
generate splashscreens should work again.
HMR will now update styles.
To get updated; you first need to do:
npm i -g nativescript@latest
That will get you the latest version of NativeScript CLI; once you have it; do a "tns --version" and verify it prints out "5.2.x". Then do a "tns doctor" to verify your environment is up to date and has all the newest support tools you need for a successful build.
To update a project; you need to do the following:
tns platform remove android && tns platform add android@latest
tns platform remove ios && tns platform add ios@latest
Latest Core modules:
npm r tns-core-modules --save
npm i tns-core-modules@latest --save
To install Webpack & HMR support:
npm i nativescript-dev-webpack@latest --save-dev
Note: you need to have nativescript-dev-webpack as a development dependency for HMR to work.
To install latest NativeScript Angular plugin
npm i nativescript-angular@latest --save
You will then need to install the actual angular bits; which as of this post v6 is currently supported.
The addition of all the additional analytics/tracking to the CLI reminded me; you can disable it permanently; if you value your privacy by doing:
tns usage-reporting disable && tns error-reporting disable
- HMR does NOT currently work with local plugin development out of the box. (See: https://github.com/NativeScript/nativescript-dev-webpack/issues/656)
- TNS --syncAllFiles still frequently crashes and you have to kill it when it fails.
- TNS sometimes can't be stopped with a CTRL-C