PhoneGap offers a nice solution for writing cross-platform apps with HTML5 and JavaScript.
But I would like to use Interface Builder for the UI, and just write all the controller code in Javascript instead of Objective-C (with of course the option to mix and match and especially call into any Objective-C libraries that I may need).
Is there a framework for this? Something akin to what CamelBones does for Perl.
The reason for wanting to do this is that the non-UI code can ideally be written in JavaScript to be reused for the web version, an possible future Android PhoneGap version, and the server-side (node.js).
You could try using Appcelerator's Titanium product. It lets you write native iPhone apps in HTML+Javascript.
Check it out here. I haven't used it, but it seems like what you want.
The other possibility is to use iOS Javascript Bridge to write an app in Javascript.
https://github.com/coolbloke1324/iOS-JavaScript-Bridge
You can try JSCocoa. It lets you write Cocoa apps in JavaScript, like a bridge.
It works on a Mac and iPhone. It also works with Interface Builder while you develop.
Here's an article that mentions a few alternatives to using Objective-C
Just stumbled upon this (old) question but wanted to contribute by mentioning NibleKit (http://www.nimblekit.com/index.php) that let's you build native iOS apps with just HTML & Javascript.
Related
Our team intends to use JavaScript library observablehq/plot from an app written in C# and running on .NET 5. As a proof of concept, we were able to successfully use that library running in a separate process on Node.js. The downside of this approach is that we would need to implement all data serialization and inter-process communication ourselves, and we would need to bundle Node.js in our app installer. We are looking for an alternative approach that would not require Node.js, but instead would directly host V8 JavaScript engine in our .NET app. Currently, we are considering using ClearScript package for that. While we were able to successfully run simple JavaScript code using it, we discovered that observablehq/plot and its dependencies use some APIs that are present in Node.js, but are apparently unavailable in ClearScript out-of-the-box (it seems that Node.js implements some of those APIs in JavaScript, and some in C++). Making those implementations available to ClearScript running in .NET app looks like a significant task whose cost I cannot estimate at this point.
I would like to ask if anyone had to solve the same or similar problem, and what approach would you recommend? Is there an easy way to make all necessary APIs available to observablehq/plot running on ClearScript? Should I consider hosting Chromium/Edge browser engine in the .NET app instead? I haven’t yet tried this, but I assume it is possible because my understanding (correct me if I’m wrong) is that WebView2 control can be used in WPF apps running on .NET, and it is implemented using Chromium and V8 JavaScript engine. Is there any other approach you can recommend?
Update: The app GUI is built on Avalonia and SkiaSharp. It is possible that eventually we will choose another charting library, perhaps, one not written in JavaScript. But my task at hand is specifically to investigate whether and how we can use JavaScript libraries in our app, taking observablehq/plot as an example, and investigate its features and performance characteristics.
If you are building a WPF desktop app you should try a WPF based chart library that feats your needs.
Open source libraries:
OxyPlot
InteractiveDataDisplay
ScottPlot support pan and zoom.
Paid libraries:
Telerik RadChart
DevExpress
More info about WPF charts in this post.
If you are using Blazor WebAssembly:
Use jsRuntime and JSObjectReference to import and call your Javascript observablehp library.
If you are using Xamarin.Forms the best professional library out there is probably SyncFusion:
Syncfusion Charts
Update:
Avalonia Framework only will support this through a webview / embedded browser as you stated above. Here you have 3 options:
Cefnet is a .NET CLR binding for the Chromium Embedded Framework
CefGlue same than above
WebView Avaloria-CefGlue
For more usefull tools and libraries to use with Avalonia please refer to Awesome Avalonia.
I have a desktop application that has a C++ backend and a HTML5/JS front end. We are currently having to use Google V8 or Mac Webview and Objective-C to allow Javascript and C++ to communicate. Is there any way to have them directly talk to each other without the middleware?
Trying to accomplish:
Share variables.
Call Functions from C++ to JS.
Call Functions from JS to C++.
I have tried googling this and everything points to the above solutions.
You could try using Google's Protocol Buffers which allows you to create data objects that get compiled to C++ objects. You could then use one of the following projects from their wiki to use protobuffers with javascript:
https://github.com/sirikata/protojs
http://code.google.com/p/protobuf-js/
Your software sounds like a lot like a web app, without the internet in the middle. NodeJS might make good middleware in this case, you can write modules for it in C++, and use them in javascript. I haven't done this yet myself. A short example :)
And now a few years layer we have the Electron project, which is basically the above but with a Chrome based web view.
I wrote a library for that
Take a look to https://skywarpcpp.wordpress.com
SKYWARP++
Data streaming and rpc enabler server library for c++ Applications
You can download it at github
https://github.com/xjrueda/skywarp_cpp
You can now use Electron to get basically a Chrome web browser with direct access to the Node.js API. Then you can use nbind to easily call C++ code from JavaScript. This way both share the same thread and heap.
You declare the C++ classes by adding something like this to a C++11 source file:
NBIND_CLASS(X) {
construct<int, int>();
method(Y);
method(Z);
}
That creates bindings for a class X with a constructor taking 2 ints and methods Y and Z with pretty much any kind of arguments and optional return values.
nbind comes with an example for how to package your C++ code into a Node.js addon, for use in Electron.
Please have a look at this , I am the owner
http://code.google.com/p/libjspp/
libjspp allows easy interfacing & interacting of C++ with javascript spidermonkey 1.8.5?
Non intrusive to C++ & javascript world at same time.
Useful for applications which want to Embed & Extend Javascript in object oriented manner.
Very thin interface virtually no overhead by using C++ templates.
I am
I'm trying to get a javascript variable from my webview and convert it to a String variable in Java. But i'm new to javascript and can't figure out how i can do this.
Can anyone help me?
How about using the Android Java/JavaScript bridge to send data between the two layers. The integration technique is part of the core Android framework.
PhoneGap is also great but is overkill if you just want to stick to Android
Here is a tutorial on how this stuff works: http://code.google.com/p/openmobster/wiki/JavascriptBridge
Full Disclosure: I am the Chief Engineer of OpenMobster and I wrote this tutorial
There is no easy way to just pull a variable from client side javascript into application level Java. Hopefully someone can come along and give a good original answer. However, the PhoneGap library has an easy way to do this. PhoneGap can tie javascript events to native application events which is extremely useful. If you really want to do this I would recommend at least checking out PhoneGap.
Specifically, I'm looking at the recently released qMobi and wondered if anyone has had any luck getting JavascriptMVC to work with it.
I'm assuming Zepto doesn't work with it?
Has anyone tried either?
For context, I'm currently creating mobile (and mobile web) apps using Backbone + Zepto but I like JMVC's build environment and built-in testing tools. I'm not however, a big fan of being tied in to jQuery which IMHO is a little too heavyweight for mobile web app development.
I think JavaScriptMVC is modular enough to use its ecosystem (StealJS, FuncUnit, ...) in your building process without using jQueryMX. The building system will depend on jQuery, but the released application will not.
As has been said, you could leave out jQueryMX and just use steal, etc. to build test and document, but that's kind of like buying a car without an engine.
In theory, it's possible that another library with a jQuery compatible syntax could drive jQueryMX. Try replacing jquery/jquery.js with qMobi and see if it works. I'm guessing that it wont though. The controllers in particular leverage jQuery pretty heavily, and most plugins are going to assume it's the real jQuery.
I want to introduce a class to mobile development. In the past, the long installation process for using things like phonegap deterred many from completing the assignment, so this time I want to keep things as simple as possible.
My preferred languages are javascript, css, and html. I know I can create a mobile version of a website using these languages, but that would go through a web browser. Is it possible to build an app purely using these languages and install it on a phone, with an icon and everything?
You should look into jQuery mobile. It's a HTML5 Javascript library for easy app creation: http://jquerymobile.com/ It should be good for students to use for assignments.