Search code examples
swiftmacosfinderfindersync

Launch macOS app from FinderSync extension


I wrote an app that implements FinderSync extension.

Everything works fine, I can "communicate" by sending notifications through DistributedNotificationCenter from extension to main app. But obviously it works if the main app is running only.

Is there any mechanism to open terminated app and pass parameters?

UPDATE:

The idea is to implement simple image processing app. I want to run the main app (containing execution code and GUI) from Finder-Sync extension.

To be more specific I implemented func menu(for menu: FIMenuKind) -> NSMenu? of FIFinderSyncProtocol and I want to run/open main app when user right-clicks the menu item and selects operation I added into menu.


Solution

  • As I guess that my comment is at least somewhat valid, I'll put it in the answer.

    Extensions allow launching of the main app by using the URL that app handles.

    Communication with URL may not be enough, but you can have the app group where extension could write the data to disk and be readable by the main app or use your current way of communication with some adaptations to this method.