How can I call native ios api from cocos2d html5 with javascript binding project? - ios

Can cocos2d html5 with javacript binding project for ios call ios native api? I am looking for the way to access the ios device camera, photos, etc.

Nope. The whole point of the JS API is to have a common subset of the API that works across all platforms (on the web you can't access the camera or a photo library), with the exception of the most commonly needed features like input.
You can write the camera etc code in Objective-C. You can then expose your methods as JS bindings as needed.

You can wrap the Cocos2d-html5 project in Cordova, then use the Cordova methods to call all the native functionality you mention

Related

Show dialogs from JUCE library

I want to develop an iOS/MacOS app which would use Metal for rendering. This is not supported as a “main window” by JUCE (yet). The reason I was to use JUCE is because it unifies acquiring access to audio interfaces, which is quite different between iOS and MacOS (and also has a GUI component for configuring the audio source, which AudioKit doesn’t have, which is why I don’t want to use it).
I’m struggling to generate a project in JUCE that would have Metal-backed view as a main component. So I’m thinking to instead make a library using JUCE, and then make two native apps for iOS and MacOS which would both use that library. The library would be used to show the dialogs for configuring the audio input (and other parameters that I have, through custom components).
The question: is it possible to make a JUCE library which would be capable if showing dialogs (on both iOS and MacOS) to configure my app, and then use this library from the native iOS and MacOS apps that would have a Metal-backed main view?
Thanks in advance!

Is it possible to use NativeScript's WebView as a WebMap in a hybrid app?

For example, the WebView will load a local map.html
This map.html will have a map loaded on it via main-page.js, so this JS file will by both Native and WebView elements.
On top of this WebView map will be a floating native button that pans the map to your location.
Is this flow possible in NativeScript? A JS file that controls both native elements and a WebView
If possible, how is this integration achieved? Does it need some complex setup?
Is this flow recommended? Would it cause any major performance issues?
It's absolutely possible to have a WebView and place native button over it. But you can't control everything within single JS file, you have to use nativescript-webview-interface plugin to interact between WebView and native functions.
If you ask about performance, WebView is never great not just with NativeScript but in general. Imagine how you would feel when using your Google Maps within Chrome of your Android, that's going to be the user experience. Almost every map apis got native libraries for iOS & Android, at least {N} has plugins for Google Map and Mapbox, so I would recommend that.

Is possible to use React Native *only for UI* and the logic in .NET?

I need to create a multi-platform app for web, ios, android and partially desktop.
I wish to use .NET/F#, but the UI is a complication. I have tried Xamarin.Forms and it is too limited to me. I could live to use React Native but I don't wanna to code the full app in javascript, instead, I wish to use F# for all the logic and web backend, and use react only for the UI in mobile.
But I wonder how?
How feed data to the UI and react to events there?
P.D: If nativescript make this possible I'm all ears. I'm still not rule out xamarin for it, but forms is too limited and the nature of the apps and so far think react native is the closer to my needs.
There's already a sample of this, because the entry file of the Fable React Native demo is a pure JS file that calls the JS generated by Fable. You just need to extend this pure JS layer and import the code generated by Fable when needed.

Can I use F# to build a (cross-platform) library for use in an otherwise native iOS application?

Subject line pretty much describes it. I'm looking for a toolchain to build a cross-platform business logic library that would be consumed by (among others) an otherwise native iOS application.
I'm thinking about using F# for this library, as I like its functional approach and what I've read about performance seems at least reasonable.
I'm wondering how feasible it is to write this library in F# and then invoke/consume it from an otherwise native (probably Swift) application on iOS.
You can use Fable to compile your library and then write your app in React Native to consume it as a native app in iOS. Here are some interesting things you can do with Fable. http://www.navision-blog.de/blog/2016/08/14/fable-sudoku-creating-a-sudoku-solver-app-with-f/
If you don't want React Native, then your other option is to call the generated JS code directly from your native code, but that's a bunch of boilerplate and casting for each function call. How to call JavaScript Function in objective C
The solution I think you're hoping for is to be able to compile to Xamarin and use the library from an iOS app like a native library, however that's not possible.

Using Protocol buffers in PhoneGap - iOS

I have used the c++ google protobuf classes in iOS using the native app approach, i.e. using Xcode, objective c, cocoa etc.
Now, I want to migrate to hybrid apps and I have explored the options on web, and according to my requirements i'm down to PhoneGap and Titanium. That will require me to use JavaScirpt, HTML5 (JavaScript only in Titanium as per my understanding) jQuery etc.
My question is, HOW am i supposed to access the my c++ protobuf classes from javascript. (i have no expertise in JavaScript).
I am also open to opinions on which hybrid-app framework to use.
Lords of web-dev....guide me.
With PhoneGap, if there is a phone feature that the PhoneGap APIs do not currently expose, or if you have some specialised native algorithm / function that you wish to access, then you need to write a plugin.
PhoneGap plugins provide a standardised mechanism for packing native code and accessing its functionality via JavaScript. See the PhoneGap Plugin Development Guide.
Personally I think PhoneGap is the best hybrid framework, it had been around for a while, is well documented, and has a healthy community.
This is an old question, but you can always use the 100% JavaScript implementation of ProtoBuf in your JavaScript code. It works well, and you can even precompile the .proto file if you want.
In Cordova it would be better to create a plug-in, but if you don't have time or skill to do that, the linked code works well.

Resources