Incorporate exported Codea project into a larger iOS application

Hello everybody,

I have an app made in Codea 2.3.2 and successfully exported it to an Xcode project. I would like to know if there is a way to have a larger native iOS app and incorporate the one made with Codea into it.

More specifically I would like to start the app with native iOS views and after some point to navigate to the view made with Codea and also pass some data to it.

Could this be possible or am I asking too much? Thank you in advance.

@dokimiDev depending on your knowledge of coding, it isn’t too difficult. I’m not on xCode right now, but I remember when coding my game that in the application didLaunchWithOptions, there is a method that reads the Codea files. You can probably call that in your native iOS app. Also, it depends on if you want to have Codea be the dominant application or the native iOS app to be the dominant application. They’re both possible, I think it will require some work tho.
Good luck!

Thank you @CamelCoder.

First of all I would like to make clear that I need the native iOS app to be the dominant application.

Up to now I managed to create a storyboard loading another view instead of loading the Codea app. I managed this by removing the lines of code that load the Codea app in AppDelegate.

Now I am trying to load the Codea app from inside a ViewController of a view that I navigate from my native root view. I try to do this by calling the methods used in the AppDelegate to load the Codea app (as you advised me to do), but no luck. :frowning:

@dokimiDev if you import the class of StandaloneViewController/StandaloneViewController.h, then you can access th viewController that Codea offers from there. I have never tried what you are trying, so that’s why I can’t give you a specific way to do it, I can only give you ideas. Good luck!

@dokimiDev you should be able to present the CodeaStandaloneViewController from your regular UIKit app like any normal view controller.

I have attached a sample Codea exported project I’ve modified to present a UIKit view controller written in Swift which has a button that will present a Codea project when you tap it. Hopefully this helps you.

Edit: Look at MyUIKitViewController.swift and the simple change to to use this view controller as the root.

@CamelCoder thank you very much! I have to struggle to make it work.

As for the part that I need to transfer data from native the codea part and vice versa does anyone know if it is possible?

@dokimiDev it’s possible, but you’d need to write a Codea Addon in order to expose an API to your Lua code that can call some C code which can then talk to your Objective-C / Swift code.

@Simeon thank you very much! For the sample project and for the advice! I will try the sample project as soon as possible and afterwards will take a look at the add-ons so I will create my own.