I am learning SwiftUI. I want to write an image browser which I can put into "Application" directory and use it as default image browser. I'd like to choose my app in right click menu: "Open in application..."
I know how to make it in Windows / Linux where I have to ensure that my application can read arguments passed as parameters. For example: "MyImageBrowser.exe d:\images\photo.jpg"
I know what to do inside:
CommandLine.arguments.forEach() { /* do something with the parameters like reading the file */} or how to display the image
let url = URL(fileURLWithPath: param) //param is obtained from CommandLine.arguments let image = NSImage(contentsOf: url)! and
var body: some View { Image(nsImage: image) .frame( maxWidth: .infinity, maxHeight: .infinity, alignment:.center) } The thing that I don't know is how to "force" MacOs to pass the parameter with the location of a image to open.
I compiled my code and the result (iSee.app) copied to Application folder.
Then I tried to open an image by clicking on it and choosing "Open with...".
I received warning:

