4 ms·
I was waiting for my NativeScript app to build when I came across this article! I'm a web developer by day (Ember / Node) and believe that the web platform wil
by binarynate 10y ago
I was waiting for my NativeScript app to build when I came across this article!
I'm a web developer by day (Ember / Node) and believe that the web platform will ultimately come out on top due to its inherent cross-platform support, "install-less" use, and open design. For the time being, though, browsers still lack support for many hardware APIs, which still make native apps necessary for many interesting use cases.
The use cases I'm tackling with my current app require MIDI and Bluetooth Low Energy support. There is interesting work underway to draft web standards for such APIs (there is a working draft for web MIDI that is implemented in Chrome and an unofficial web bluetooth API that can be turned on in Chrome), but general support is far off.
Luckily, I learned about NativeScript on the Hanselminutes podcast and started working with it in September. Overall, I have been really impressed with the completeness and functionality of the NativeScript runtime, its CLI, and the design for code sharing. Unlike React Native, NativeScript aims to allow you to share both your application and UI code across iOS and Android. You write your application in JavaScript (I use ES 6 with the babel plugin), your UI in XAML-like XML, and your styles in a subset of CSS.
For the application code, NativeScript provides common APIs that share the same interface on iOS and Android. There are still gaps in APIs that have been implemented out-of-the-box, but one of NativeScript's biggest strengths is that you can also access the native OS's frameworks within the JavaScript runtime, enabling developers to create plugins with a common interface for the APIs they need. For example, I'm developing a MIDI plugin to provide a common interface for MIDI on iOS and Android, which I'll open-source on GitHub / NPM once it's mature. The native frameworks are converted to JavaScript at compile time, so whatever native code you include (e.g. Objective-C classes, C libraries) are usable from within your app's JavaScript.
In my case, my app communicates with an embedded Bluetooth SoC in a product I'm developing, and I'm able to reuse C libraries I originally wrote for the embedded platform in my mobile apps. So, I'm sharing my mobile app code across and iOS and Android (huge win) and sharing some core messaging code across iOS, Android, and my embedded platform (bonus win).
- deleted 10y ago[deleted]
- binarynate 10y agoSince my MIDI plugin is ready to use for iOS, I decided to go ahead and put it up on GitHub. https://github.com/BinaryNate/nativescript-midi https://github.com/BinaryNate/nativescript-midi https://www.npmjs.com/package/nativescript-midi https://www.npmjs.com/package/nativescript-midi