I have successfully used MacSigner to create an application on Mac. On my Windows version, I set associations to an extension (e.g. .PBN) and when I double click on the file, the path is automatically sent as an argument that I can get through Main.appnames. On the Mac, however, this is not the case.
Reading up on the matter, I have read an article that says, "To have a macOS application receive a file path as an argument when you double-click a file (or drag-and-drop it), you must register that app to handle specific file types and utilize Apple’s Launch Services, which sends the file path as an Apple Event. If you are developing your own .app bundle, you must inform macOS that your app can handle files.
Reading up on the matter, I have read an article that says, "To have a macOS application receive a file path as an argument when you double-click a file (or drag-and-drop it), you must register that app to handle specific file types and utilize Apple’s Launch Services, which sends the file path as an Apple Event. If you are developing your own .app bundle, you must inform macOS that your app can handle files.
- Edit Info.plist: Add the CFBundleDocumentTypes key to define which file extensions or UTIs (Uniform Type Identifiers) your app supports.
- Handle Apple Events: Your application code must handle the appleevent aevt/odoc (Open Documents) to receive the file paths.
- SwiftUI/AppKit: Implement the application(_
penFiles
delegate method. [1, 2]