Calling Obj-C library from Corona application - ios

I have a large library written in Objective-C that I would like to use from a Corona app (as a plugin).
I read that Corona Enterprise supports native libraries so long as it is wrapped in a Lua interface.
What is the process of wrapping a native library? Would it be easier to write the library in plain Lua instead?

Corona Enterprise allows you to build a Corona SDK based application that can call Objective C or native Java routines (for Android). You end up building a native app that calls your Corona code. There are bindings that let you pass data between Obj-C/C++ methods and Lua.

Related

Is Kotlin Multi-platform Mobile code different from compiled Swift code on iOS platform?

According to docs
Kotlin/Native is a technology for compiling Kotlin code to native
binaries, which can run without a virtual machine. It is an LLVM based
backend for the Kotlin compiler and native implementation of the
Kotlin standard library.
So K/N is using LLVM to compile Kotlin code to native code for iOS. Swift compiler also uses LLVM to optimize and generate machine code.
So is there any difference between compiled K/N vs compiled Swift code on iOS platform?
If so what are those differences? Performance and etc.
The main difference is that Kotlin code compiled for iOS brings along the Kotlin/Native runtime which establishes the Kotlin/Native memory model that aims for safe concurrency and immutability of global objects, and also provides its own garbage collector for Kotlin objects.
Otherwise, code compiled with Kotlin/Native indeed has two-way interoperability with Swift, as normally the Kotlin binary that you use on iOS is an Objective-C framework that you can import in one project with Swift.

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.

Porting C code for an iOS app

I am working on building an app that needs to use a C library that I have.The C code is designed for Linux platform and has Linux system calls.
Firstly, I would need to port this C code to run on iOS. Is it possible to do so? Are iOS apps allowed to use system calls? (I read elsewhere that apps using syscall.h are not permitted on the appstore)
Secondly, once I have ported the code can I include them directly in my swift code? Or would I have to create .so files or any such thing.

How to organize Android NDK / iOS project

I wrote a game for Android using Android NDK. Core of game logic written in pure C++. So, I want to port it to iOS. I know how to port Java (JNI) wrapping to Objective-C.
My question is how to organize this project on FS? I want to keep a single code base, and I use git (link).
First, note that there should be no need at all do wrap your C++ code: the objective-C extension of the C language is also compatible with C++. So, you can compile your code as "Objective-C++" and directly use C++ classes with Objective-C code.
Second, you can put your code anywhere you wish on the disk. Both eclipse for Android and xcode for iOS will let you include source code into your project from any relative directory.
If you ever need platform-specific native code you can use #ifdef __ANDROID__ for android-specific code inside your C++.

Corona SDK and IBOutlets

Somebody correct me if im wrong.
There is no way (at least no supported way) to create a View/Windows based iPhone app using the Corona SDK?
I say this mainly because i see no way to work with IBOutlets (anything related to the interface builder). Which makes me believe Corona is not converting anything to Objective C, but rather converts the Lua script to C/C++.
Thanks!
The latest new feature in Corona (currently available only to subscribers) is Corona UI, which emulates most of the native UI components:
http://www.youtube.com/watch?v=9UHNSRilB-0
Note that I say "emulated." It's still not connecting to IBOutlets but it may accomplish what you want.
Corona UI supports most of the native UI components, you can also include widget_iOS for other native components of iOS otherwise you can create your own custom objects.
We can achieve it using Corona Enterprise edition. It has all the option to bridging between LUA and C/C++, lua and objective-C or LUA AND JAVA.
Corona Enterprise provides feature to work in Xcode- objective-C environment to execute same functionalities in corona apps.
http://docs.coronalabs.com/native/enterprise/index.html
Hope this helps for your question.

Resources