How to embed mac app extension in Electron app?

I am trying to implement the Finder Sync extension written in Swift in my application written using Electron . How can I make them work together and communicate with each other? I read the Apple documentation , but explains how to add a target to a native application. I also noticed that I can manually paste the .appexcompiled file (created by Xcode) into the application folder Pluginsusing the electronic builder . How can I develop and test an extension in Xcode and embed it correctly in an Electron user application? Any suggestion?

Thanks so much for any suggestion.

+4
source share
2 answers

Create the PlugIns folder in the Electron root folder.

Copy the .appex file to the PlugIns folder.

If you are using an electronic builder, modify the package.json file - add: "extraFiles": ["PlugIns/"]in the "mac" section.

Build. The contents of your application package will contain the PlugIns folder and your apx file inside, and the application will be loaded into your application process.

+1
source

How to embed mac app extension in Electron app?

, , child_process.execFile

execFile, ( )

const util = require('util');
const execFile = util.promisify(require('child_process').execFile);
async function FinderSyncExtPlugin(ARGUMENTS) {
  const { stdout } = await execFile('YourBinary', ARGUMENTS);
  console.log(stdout);
}
FinderSyncExtPlugin(['argument1','argument2','...']);

stdout, / .

0

Source: https://habr.com/ru/post/1683423/


All Articles