Before all, I'm very new in swift cocoa application.
I'm developing an MacOS application for my company, the goal of this is to open a file ("right-click -> open with my app") to process it.
But after couples of search, I'm not enable to find a way to do it. (I probably didn't search the good terms, but like I said I'm very new to this)
(I've done a similar things to windows, using the registers)
Somebody has an idea? link, documentation ?
Thanks !
Please have a look at Document based applications. It is a huge topic: https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011179-CH1-SW1
As soon you register for types of documents you app can open, this feature will work the same way as in Windows. I.e. if you register custom extension, you app will onep this file by default. If you specify lets say you app can open pictures, it will show up in "open with" right click popup menu.
Pay attention to document types registration. Here is an example from one of the books (Learning Swift 2016):

You can use finder extensions to do this. If you need more flexibility, you can use notifications to communicate with the main app and change right click menu items dynamically. Here is an app that uses the approach to add custom right click menu items. The page has a link to the source. finder extensions also have helpful examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With