Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Native OS X apps in JS?

I would like to write an application in JavsScript that runs natively on OS X. It would be a bonus if it could be used for Windows apps as well, however I am primarily interested in the OS X / Cocoa tie in initially.

I was entertaining the possibility of writing all of the business logic in JS and then the primary UI components with Cocoa and .NET respectively, but I got to thinking that it would be nice if there were something already in place that would facilitate such a workflow without having to support a few different codebases.

After researching this a bit, I obviously became overwhelmed with the solutions that seem to exist for iOS development, however hitherto I've found nothing that really seems to also work on OS X. Are there any solutions that I may be overlooking? If not, what might be the recommended path for basing most business logic in a JavaScript app and interfacing with that for the native UI components?

like image 603
ylluminate Avatar asked Jun 05 '13 19:06

ylluminate


People also ask

Can iOS apps be written in JavaScript?

JavaScript frameworks are well-suited to mobile app development, as they can be used across a number of platforms, including iOS, Android, and Windows.

Can apps be built with JavaScript?

JavaScript is the top language for incorporating interactive, engaging elements — both simple and complex — into an app or web page. In fact, it's one of the most popular languages for front-end development, used for web design and development, mobile app development, enterprise applications, UX and UI, and more.

Can I use React Native for macOS?

React Native for Windows + macOS brings React Native support for the Windows SDK as well as the macOS 10.14 SDK.

Can you make Mac apps on react?

React Native as a JavaScript framework is the most popular for cross-platform mobile development. Can also be used to create desktop applications for Windows and Mac devices using Microsoft framework - React Native for Windows + Mac OS + Mac.


2 Answers

This is becoming a hot topic. I suggest you read this article about a JavaScript Objective-C bridge for OS 10.9. Also, check out this code sample from Apple in which the application controller is simply responsible for communicating between objects and JavaScript is really driving everything. The sample is called JavaScriptCoreHeadstart and Apple describes it as follows:

JavaScriptCore is a new system framework available in Mac OS X 10.5 that allows applications to run JavaScripts. This sample shows one way to use JavaScriptCore for providing user configurable features in a Cocoa application. Here, a number of JavaScript objects are defined that represent various parts of the application and the application's controller is really just a thin shell that calls JavaScripts that decide how the application will operate in response to Interface Builder action method calls and WebKit delegate callbacks. The JavaScripts themselves control the application through the objects that represent different parts of the application.

like image 191
ChrisP Avatar answered Sep 30 '22 12:09

ChrisP


There is NodObjC that should allow you to write Cocoa applications for NodeJS.

like image 41
Eelco Avatar answered Sep 30 '22 11:09

Eelco