Question

I am thinking of learning Haxe, after extensive as3 experience and some javascript/nodejs but several people have stated that haxe compiles into a swf and encapsulates it to be run on "insert platform here" making it both incompatible with some native features and with significant overhead.

I am interested in knowing about ipad/iphone specifically. Does this somehow compile into a format compatible with such apple devices? I mean does it translate to x-code then compiles it or what?

I have various clients that want cross platform versions of the same application and Haxe looks like a simple, elegant solution but since my clients are from US, Apple products are a concern to me.

My scope of projects revolves around simple apps with server services and maybe some webcam/microphone action, if this helps for an answer. Cheers.

Was it helpful?

Solution

haxe compiles into a swf and encapsulates it to be run on "insert platform here" making it both incompatible with some native features and with significant overhead.

This is a big misconception. Though as with any cross-platform tech, it's a somewhat nuanced answer.

First, know that Haxe is simply a programming language that compiles to many other language (& bitcode) targets, e.g. JavaScript, C++, PHP, python, SWF, hl, neko and others.

Compiling to C++ is the typical path when building native Android and iOS apps (and Windows and Mac apps, for that matter). Also, Haxe is just the language. Usually a framework is used for building apps, and there are many choices -- OpenFL, or its predecessor Haxe NME, or heaps.io, or HaxeFlixel, or luxe, or Kha.

Each framework is unique in paradigms and workflows, but for example, last time I used OpenFL, it exports an XCode project with C++ code when building for iOS. You are then expected to open and compile the project in XCode and onto your device (or for the app store), just like any other iOS app.

While using a framework is a common way to build apps with Haxe, you can roll your own, if you like, for example:


Compile Haxe to JavaScript, using externs to leverage existing JS libs (e.g. here's a set of Pixi.js externs, or the built-in jQuery externs), and develop mobile web apps with Haxe. Note: many of the above frameworks support a Haxe -> JS workflow.


Compile Haxe to SWF, and then use the Adobe AIR SDK to package your app as a native iOS / Android app. This avoids XCode and is possible from Linux and Windows (where compiling an XCode project is not). Perhaps this flow is what those other people were talking about.


Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top