Settings

Theme

NativeScript with Universal Windows Platform Support

github.com

33 points by andreashansen 10 years ago · 13 comments

Reader

iLoch 10 years ago

Small recommendation for folks looking to use JS for Windows development (I understand this is just a runtime, but people may be inclined to combine these two things): do not use WinJS for any reason. It's undoubtably the worst UI "framework" I've ever used. Completely inflexible (HTML and styles defined in private and inaccessible methods, swallows events, monolithic functions) and riddled with bugs and incomplete features. Really surprised it's an official Microsoft project. I don't mean to disparage the developers of it, but it's really bad. Don't use it if you value your time or peace of mind and plan on customizing it in any meaningful way.

  • prplhaz4 10 years ago

    So, have you had a positive experience with any alternatives in the same use case?

    • iLoch 10 years ago

      I'd recommend copying any particular CSS transitions they use, and looking at the computed properties of components in order to recreate any particular WinJS components you need. I'd also recommend you evaluate WinJS yourself and see if it fits your needs - but if you suspect you'll be doing anything more that the default then you may not have a fun time.

Aleman360 10 years ago

Do yourself a favor and use C# or even C++\Cx instead. They're both a much better fit for XAML.

Full disclosure: I work at Microsoft on XAML UI in C++. It's nice. Opinions are my own.

  • jasonjei 10 years ago

    I agree. I think it's cool that somebody is trying to create a JS API runtime for Win32, but the same criticism for using RubyMotion to build iOS apps applies. It ends up feeling too unnatural and stressful to use, with an extra dependency you have to rely on for support.

    I believe that using Win32 API in C/++/# (maybe one day with Go if all the OS functions are mapped) is much more natural than forcing yourself to do it in JS. A lot of the Windows APIs still require you to manage some memory (I'm not sure how much is abstracted in C#, but if you are doing it through DllImport, Win32 will still expect you to free memory if you are using OS API functions as it was designed for C).

    On top of that, you will spend a lot of effort trying to box/re-package documentation intended for the C/++ (ATL/MFC/WTL/etc) or C# (WPF) audience. This is probably the greatest cost. In the end, I suspect NativeScript code looking a lot like the C equivalents. Consuming third party libraries written in unmanaged code is likely to produce very ugly code.

    I tried using RubyMotion a long time ago for iOS development. All of the sample code I found was in Objective-C, and I pretty much spent most of my time rewriting the code in Ruby, or parsing docs in ObjC and figuring out the Ruby way to do things. In the end, it was simpler to just do it in ObjC.

    Writing the app in a SDK with a lot more support is just much better. Your sanity will thank you. And if you are writing cross-platform code, C has endured the test of time.

    • Aleman360 10 years ago

      NativeScript is targeting UWP, not Win32/WPF. The UWP API's are way better and C#, C++, and JavaScript are supported out-of-the-box. But if you go the JavaScript route, only HTML is officially supported for UI. You can get native-looking widgets using WinJS, but the XAML framework is the real deal. XAML sits directly on top of DirectComposition, so no DOM\Webview.

  • mwcampbell 10 years ago

    But what if I also need to target iOS and Android? Isn't that the problem NativeScript is trying to solve?

    • Aleman360 10 years ago

      I'd still choose to use C++ or C# for cross-platform code if starting from scratch.

      However, I've never had to work on cross-platform apps, and have never been subjected to JavaScript professionally, so my opinion is probably worthless.

      • andreashansenOP 10 years ago

        Xamarin would probably be the framework/tool of choice if you want C#. Other than that, most (popular) cross-platform app development frameworks I've found do use JavaScript. "Disclaimer": I'm in the middle of writing a thesis on the subject.

        • mwcampbell 10 years ago

          Since you're writing a thesis on cross-platform frameworks, have you looked at the toolchain that Google used for Inbox? They write their cross-platform non-UI code in Java. On Android, that's native. For iOS, they compile it to Objective-C using a tool they wrote called J2ObjC. For the browser app, they use GWT. The UI code is platform-specific and written in each platform's native language, i.e. Java, ObjC, and JS. They don't even try for cross-platform UI code, as Ray Cromwell explained here:

          https://news.ycombinator.com/item?id=8965349

          This toolchain doesn't cover UWP, except indirectly via UWP's support for web apps.

      • mwcampbell 10 years ago

        So why did you say C# and C+= are a much better fit for XAML? Because they're the languages that Microsoft officially supports? Any other reasons?

        • Aleman360 10 years ago

          Official support, documentation, perf (presumably), debugging, and tooling support would be my main concerns.

          Technically, XAML makes heavy use of C#'s events and properties (which C++\Cx adds to C++), which don't exist in plain old JavaScript. Also, both C# and C++\Cx support "await" natively, which is extremely nice for WinRT's async-heavy API's.

feylikurds 10 years ago

I have started to develop mobile applications with NativeScript and I am absolute in love with it. It has an Angular feel to it (I despise all things React). Before, I had only been doing backend work and I still have only taken care of the Web API portion of our NS app, but I hope to do some GUI soon. I am extremely impressed by NS.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection