Can I use Objective-C on Electron?


#1

Hi!

I’m a Objective-C and Swift developer and newbie to electron, so I’m not good at nodes and electron.

I would like to create an app on MacOS with electron. I have a functional library written by Objective-C,and this library is a little large. For lower working load, I want to find a way to reuse this library directly if possible.

I know electron can use nodejs native C++ addon and can work with dynamic-link library written by C++. But my library is written by Objective-C, I’m not sure how can I use a Objective-C library

so I have some questions here:

Q1: Can I use Objective-C on electron directly? If I can, how to do with it?

Q2: If I can’t use Objective-C on electron directly,can I package my library to a dynamic-link library or a static-link library to work with electron? If this is possible, what kind of link library is supported (i.e .dylib / .framework / .a or something else) ?

Q3: Or some other advice you can give to me ? Any advice would be appreciated!

Thanks! :slight_smile:


#2

Check out NodObjC. But honestly, if you have already have a substantial Obj-C library and want to create an OSX app, I’m quite sure it would make more sense to just build a standard Swift macOS app.


#4

Thanks for your advice. I try to use electron just because I want my app run both on MacOS and Windows, I want to maintain only one version of UI code for different platform.
But it seems that the reality is more difficult than the dream. :joy:

Anyhow,Thank you very much!