Embedding OpenFL app inside of existing iOS App


I was wondering if anyone has tried embedding an OpenFL app inside of an existing iOS app. I’d like to segue from a view controller to an OpenFL game if that’s possible. Hoping someone can point me in the right direction


How your iOS app is made? objective-c? openfl native? …

if your app is native/objective-c, I think you could use a html viewer to embed a html5 version of your game.
If it’s all html5, it should be easy.
If it’s all native, I let other people here give you an answer.


Should have mentioned that. It’s a native Objective C app. I think the HTML approach would work but I’m concerned performance will be an issue. I suppose it’s worth a shot if there’s no native option


We use SDL for windowing, so approaches like this may work:

Would love to hear what you find if you dig into this more :slight_smile:

EDIT: SDL also has a way of attaching to a pre-existing window. I’m guessing the ideal approach would be something like that, where the surface view can be created manually, then we attach SDL to a pre-existing view and move forward.

I’m not sure if its supported on iOS, though?



The following is generated when I build an OpenFL app

extern "C" int SDL_main (int argc, char *argv[]) {

    hxcpp_set_top_of_stack ();

    zlib_register_prims ();
    lime_register_prims ();

    lime_register_prims ();

   const char *err = NULL;
   err = hxRunLibrary ();

    if (err) {

        printf ("Error %s\n", err);
        return -1;


    return 0;


If I were able to get an SDL Window how would I hook into it?


This is where we create the SDL window:

This requires a build from the source of the Lime project to customize, but then it calls down into our copy of SDL (under “lime/project/lib/sdl”) into it’s platform-native code to create windowing