How to import a Swift project .framework file into a Fire / C# project?

This is beginning to get rather frustrating.

In Xcode I have a build of this Swift project: https://github.com/IBM-Swift/BlueSocket

It produces a .framework “product”. (Actually, two of them, one for OS X and one for iOS.)

I’ve created another Xcode project that contains the Swift program shown in the “read me” for the above project. To import the .framework from the first project into the second one it was simply drag-and-drop of the first .xcodeproj file into the second project, and some fiddling with the build specifications, and then the Socket.framework file showed up under “Frameworks”, and an “import” statement can be used in the Swift source code. Fairly easy.

Now I’ve set as my first task in evaluating RemObjects C# to try to rewrite the second Swift program in C#, having it call the library methods created by the first Swift project. This should be possible, right?

But unlike the drag-and-drop technique for creating an import of one Swift project .framework into another Swift project, things seem to be very, very complicated with Fire and FXGen. I’ve tried reading the documentation but none of it makes sense to me. I’m totally new to Mac and Swift and Xcode so that is certainly part of the problem. But still …

For example, the FXGen program wants links to header files, if I understand it right. But Swift doesn’t use header files, as far as I know. (The first project, from GitHub, is pure Swift, no Objective-C in it at all.)

Any advice on how to create an import of the first Swift project into a C# / Fire project would be appreciated. Thanks.

Have you checked out headerimporter ?

https://docs.elementscompiler.com/Tools/HeaderImporter/

I havent tried swift because Im using Oxygene but Im guessing it should be the same.

I create the train script which references the framework file and from that it generates the fx file.

What platform are you targeting at your new project?
If you are targeting .Net you probably will need to recompile your first project to .Net because .Net uses dlls instead framework. You can compile the swift source code of your first project to .Net but it will need some adjustments because you can’t use Foundation at .Net.
If you was targeting Cocoa you can try add your first project at references.
I hope it helps you.

Hi John, thank you for your reply.

https://docs.elementscompiler.com/Tools/HeaderImporter/

“It’s a tool designed mainly for internal use, and as such its command line options are not for the faint of heart.”

I’m sorry, but this is the point where I say “bye, bye” once again.

I did a brief evaluation of RemObjects C# two years ago, when I was getting started with Android development, and quickly decided that it didn’t resonate with my mindset. So maybe the problem is my mindset. Anyway, I bit the bullet and learned to develop Android apps in Java (a language I hate with a vengeance), and that was that.

Now I’m being forced to port my app to iPhone, and I would dearly love to do it in C#. But once again I’m forced to conclude that RemObjects C# and I just don’t get along with each other the way I was hoping.

In my experience, evaluating a new development tool should be “love at first sight”, it should be “it just works”. Sure, things are going to get rockier later when you get into production usage. But again, in my experience, if the initial evaluation is problematic then there are significant chances that production usage is going to be even worse.

But thanks for your efforts, I appreciate it.

If you continue to read it says you should you train because the command line options for headerimport are not for the faint of heart.

Train is a wrapper around headerimport. Ive never had to resort to using headerimport directly.

They give you sample train files below. In my experience its really easy.

I suggest you give it a try.